vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit ad71b52c6c5a99ad5303cbc14eeea1255bee8041
parent 6bf286812bb03b6a6a99f1155cd25d5dde4a68e9
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 19 May 2016 13:01:33 +0200

vis-menu: fix matching order, exact matches should come first

This reverts 09d0a36e0370f7ca9bdb171bf93c5ac3131c5a92 from the
dmenu repository, although dmenu itself seems to work correctly.

 $ printf "foobar\nfoo\n" | ./vis-menu

Typing foo should select foo not foobar.

Diffstat:
Mvis-menu.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vis-menu.c b/vis-menu.c @@ -244,7 +244,7 @@ match(void) len = tokc ? strlen(tokv[0]) : 0; matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL; - textsize = strlen(text); + textsize = strlen(text) + 1; for (item = items; item && item->text; item++) { for (i = 0; i < tokc; i++) if (!fstrstr(item->text, tokv[i]))