ctrlf icon indicating copy to clipboard operation
ctrlf copied to clipboard

Fuzzy match should be non-greedy

Open astoff opened this issue 4 years ago • 2 comments
trafficstars

So, for instance, the below example should have two matches on the same line, define-minor-mo and de ctrlf-local-mo. The shorter matches allow a more fine-grained movement, and greediness doesn't work well in files with long lines.

image

PS: Since this package is all about being sensible, couldn't the CRTLF prompt be replaced by something non-ugly, like Search? Also, I find that little arrow a bit gimmicky. I never forget what direction I was searching, unless I go for lunch in the middle of a search. I do sometimes loose track of whether I'm below or above the search starting point, though, which is what I initially thought the arrow was telling me.

astoff avatar Jan 15 '21 06:01 astoff

Yes, replacing .* with .*? in the greedy regexp builder should be safe and sensible, as you suggested.

I have no objection to making the prompt appearance customizable. I, in my personal configuration, would like to keep it as is, but there is no reason that everyone needs to see the same thing. Perhaps we could do something like mode-line-format, where it is a list of strings and/or symbols, like:

(setq ctrlf-prompt-format '("CTRLF " search-direction " " search-style ": "))

raxod502 avatar Jan 17 '21 17:01 raxod502

That's a neat idea, the mode-line-format-style prompt.

astoff avatar Jan 17 '21 18:01 astoff