fixed: tab completion with sgr sequences
This commit is contained in:
parent
316000a4fc
commit
1c6c041f5e
1
TODO
1
TODO
|
@ -1,5 +1,4 @@
|
|||
# TODO for spmenu
|
||||
|
||||
- Tab currently broken for SGR sequences
|
||||
- Mouse bind array (mouse.h)
|
||||
- Add configuration file using (probably) libconfig
|
||||
|
|
|
@ -109,7 +109,7 @@ complete(const Arg *arg)
|
|||
{
|
||||
if (!sel) return;
|
||||
|
||||
strncpy(text, sel->text, sizeof text - 1);
|
||||
strncpy(text, sel->clntext, sizeof text - 1);
|
||||
text[sizeof text - 1] = '\0';
|
||||
cursor = strlen(text);
|
||||
match();
|
||||
|
|
|
@ -69,8 +69,7 @@ drawitem(struct item *item, int x, int y, int w)
|
|||
// parse item text
|
||||
for (wr = 0, rd = 0; item->text[rd]; rd++) {
|
||||
if (item->text[rd] == '' && item->text[rd + 1] == '[') {
|
||||
size_t alen = strspn(item->text + rd + 2,
|
||||
"0123456789;");
|
||||
size_t alen = strspn(item->text + rd + 2, "0123456789;");
|
||||
if (item->text[rd + alen + 2] == 'm') { // last character in sequence is always 'm'
|
||||
buffer[wr] = '\0';
|
||||
|
||||
|
@ -144,6 +143,10 @@ drawitem(struct item *item, int x, int y, int w)
|
|||
int r = drw_text(drw, x, y, w, bh, lp, isrtl ? fribidi_text : buffer, 0, pango_item ? True : False);
|
||||
if (!hidehighlight && !ib) drawhighlights(item, x, y, w);
|
||||
|
||||
// this should allow us to use it for tab completion
|
||||
item->clntext = malloc(sizeof(buffer));
|
||||
memcpy(item->clntext, buffer, sizeof(buffer));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue