Closed jonathannerat closed 1 month ago
Is there any practical difference wrt highlighting when running dmenu with the fuzzymatch option and disabling it via the command line?
In my experience when using exact matching the fuzzy highlighting should be the same as the normal highlighting, but there may be edge cases I am not aware of.
I'm using dmenu as a file picker with find
, and sometimes when looking for a file fuzz-highlighting doesn't reflect what is being matched exactly. The picture below shows find ~/documents <some filters> | dmenu -i -F -l 10 ...
(that is, disabling fuzzy through the command line) in this PR (left) and current master (right). I just find it a bit annoying that it isn't highlighting what's matched
That is a good example, thanks.
Would it be better if instead of creating a function to call the actual highlight used, we set a pointer to it? Something similar to what's done with case (in)sensitive matching. That way we would remove the overhead of the extra function
Yes maybe. Alternatively it may be possible to merge the two functions into one, but not sure if that is better. Will have to take a closer look when I find time.
Revisiting this (after so long time, sorry). You are absolutely right in that it doesn't make any sense to use fuzzy highlighting when exact matching is used, or vice versa. I combined the logic of both into one function and got rid of the FUZZYHIGHLIGHT_PATCH toggle. Also addressed a multi-byte flaw in the fuzzy highlight patch.
Going to mark this PR as closed now.
Each patch introduces it's version of
drawhighlights
(_fuzzy
and_normal
), and we decide which one to run based onfuzzy
. So if we disable fuzzy matching, normal highlighting it's used.