Skip to content

console.lua: implement exact matching #16187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

guidocella
Copy link
Contributor

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.

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 mpv-player#14587.
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.
nisemono0 added a commit to nisemono0/dotfiles that referenced this pull request Apr 8, 2025
* From this PR: mpv-player/mpv#16187
* Keep MBTN_RIGHT as close menu only when the menu is visible
Copy link

Download the artifacts for this pull request:

Windows
macOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

select.lua: Allow to disable fuzzy matching, use AND for multiple search terms
1 participant