[hackers] [dmenu] Fix incorrect ordering of matching results

From: Davide Del Zompo <davide.delzompo_AT_gmail.com>
Date: Fri, 14 Aug 2015 18:28:24 +0200

dmenu incorrectly orders matching results:

$ dmenu <<EOF
suck xless
suck less
EOF

Typing 'suck less' shows 'suck xless' as first result, however, according to a
comment in the source code, this is not the intended behaviour:
    /* exact matches go first, then prefixes, then substrings */

The attached patch should fix the problem. Regarding the third argument to
fstrncmp: assuming fstrncmp, whatever it points to, behaves as strncmp (i.e.
"characters that follow a null byte are not compared"), both 'strlen(text) + 1'
and 'strlen(item->text) + 1' should be safe.

Received on Fri Aug 14 2015 - 18:28:24 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 14 2015 - 18:36:13 CEST