danielfalk / smart-open.nvim

Neovim plugin for fast file-finding
MIT License
474 stars 22 forks source link

Inconsistent search result keyword highlighting? #16

Closed lougreenwood closed 1 year ago

lougreenwood commented 1 year ago

Telescope built in find files will highlight all partial matches in the file name, for example if I search person item then the search result will have the following highlights (bold used to indicate highlight): timeline-**item**-**person**.

However, smart open highlight behaves much more erratically, for example, see this screenshot, I see some fragments of the search term highlighted, but not others.

Screenshot 2023-01-31 at 20 47 35

lougreenwood commented 1 year ago

Actually, taking a closer look at Telescope find files, it seems it also isn't behaving as consistently as I first thought... 🤔

Screenshot 2023-01-31 at 20 52 05

But searching with spaces will give more expected highlighting (but also some weird stuff too if a very long string contains any keyword in sequence.

Screenshot 2023-01-31 at 20 54 37

So maybe if https://github.com/danielfalk/smart-open.nvim/issues/15 were addressed, then the space separated search might at least behave correctly...?

marlun commented 1 year ago

I found something similar when using fzf algorithm, if I add a space the highlighting totally disappears, nothing is highlighted.

danielfalk commented 1 year ago

This is fixed on the 0.2.x branch, which is pushed and available, but still needs user feedback before I'd consider it "released".

Anyway, it now highlights differently depending on whether you use fzy or fzf so that it matches what the algorithm is doing.