[wiki] [sites] update prefix completion patch for 4.7 || Felix Van der Jeugt

From: <git_AT_suckless.org>
Date: Wed, 03 May 2017 10:09:12 +0200

commit dfca1854fed0391d3d214a955941fe1053d48717
Author: Felix Van der Jeugt <felix.vanderjeugt_AT_gmail.com>
Date: Wed May 3 10:08:26 2017 +0200

    update prefix completion patch for 4.7

diff --git a/tools.suckless.org/dmenu/patches/dmenu-prefixcompletion-4.7.diff b/tools.suckless.org/dmenu/patches/dmenu-prefixcompletion-4.7.diff
new file mode 100644
index 0000000..b350aa5
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/dmenu-prefixcompletion-4.7.diff
_AT_@ -0,0 +1,79 @@
+diff --git a/dmenu.c b/dmenu.c
+index d605ab4..826604e 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -218,7 +218,7 @@ match(void)
+ char buf[sizeof text], *s;
+ int i, tokc = 0;
+ size_t len, textsize;
+- struct item *item, *lprefix, *lsubstr, *prefixend, *substrend;
++ struct item *item, *lprefix, *prefixend;
+
+ strcpy(buf, text);
+ /* separate input text into tokens to be matched individually */
+_AT_@ -227,8 +227,8 @@ match(void)
+ die("cannot realloc %u bytes:", tokn * sizeof *tokv);
+ len = tokc ? strlen(tokv[0]) : 0;
+
+- matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL;
+- textsize = strlen(text) + 1;
++ matches = lprefix = matchend = prefixend = NULL;
++ textsize = strlen(text);
+ for (item = items; item && item->text; item++) {
+ for (i = 0; i < tokc; i++)
+ if (!fstrstr(item->text, tokv[i]))
+_AT_@ -240,8 +240,6 @@ match(void)
+ appenditem(item, &matches, &matchend);
+ else if (!fstrncmp(tokv[0], item->text, len))
+ appenditem(item, &lprefix, &prefixend);
+- else
+- appenditem(item, &lsubstr, &substrend);
+ }
+ if (lprefix) {
+ if (matches) {
+_AT_@ -251,14 +249,6 @@ match(void)
+ matches = lprefix;
+ matchend = prefixend;
+ }
+- if (lsubstr) {
+- if (matches) {
+- matchend->right = lsubstr;
+- lsubstr->left = matchend;
+- } else
+- matches = lsubstr;
+- matchend = substrend;
+- }
+ curr = sel = matches;
+ calcoffsets();
+ }
+_AT_@ -292,6 +282,7 @@ keypress(XKeyEvent *ev)
+ {
+ char buf[32];
+ int len;
++ struct item * item;
+ KeySym ksym = NoSymbol;
+ Status status;
+
+_AT_@ -447,12 +438,17 @@ keypress(XKeyEvent *ev)
+ }
+ break;
+ case XK_Tab:
+- if (!sel)
+- return;
+- strncpy(text, sel->text, sizeof text - 1);
++ if (!matches) break; /* cannot complete no matches */
++ strncpy(text, matches->text, sizeof text - 1);
+ text[sizeof text - 1] = '
Received on Wed May 03 2017 - 10:09:12 CEST

This archive was generated by hypermail 2.3.0 : Wed May 03 2017 - 10:12:18 CEST