console.lua: implement exact matching #16187
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
console.lua: implement exact matching
Allow matching items exactly instead of fuzzily when prefixing the search with ' (like in fzf) or with --script-opt=console-exact_match=yes.
This is mainly useful to filter history entries chronologically.
You can also specify multiple search terms delimited by spaces. But ' makes every term an exact match, unlike fzf where you need to place it before every word, since we can't hook into fzy's algorithm.
Closes #14587.
console.lua: repurpose case_sensitive to only affect exact searches
case_sensitive originally only affected Tab completion. It defaulted to yes outside of Windows just to emulate the bad defaults of bash and zsh (not fish, which has better defaults and defaults to case-insensitive completion). This was already silly, but then it affected the fuzzy autocompletion and case-sensitive fuzzy completion is even more silly. And since 0b3cc3a, it accidentally stopped affecting even that, because the completion via script message never checked for the option. Nobody even noticed this, meaning that nobody was relying on fuzzy autocompletion being case-sensitive.
Just make case_sensitive only affect the new exact search, and make it default to no on all platforms. Though IMO the search could just always be case-insensitive.