bakkeby / dmenu-flexipatch

A dmenu build with preprocessor directives to decide which patches to include during build time
MIT License
183 stars 78 forks source link

Remove fuzzyhighlight precedence over hightlight patch #16

Closed jonathannerat closed 1 month ago

jonathannerat commented 1 year ago

Each patch introduces it's version of drawhighlights (_fuzzy and _normal), and we decide which one to run based on fuzzy. So if we disable fuzzy matching, normal highlighting it's used.

bakkeby commented 1 year 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.

jonathannerat commented 1 year ago

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

image

bakkeby commented 1 year ago

That is a good example, thanks.

jonathannerat commented 1 year ago

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

bakkeby commented 1 year ago

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.

bakkeby commented 1 month ago

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.