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 0b3cc3a167, 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.
This commit is contained in:
Guido Cella authored and Kacper Michajłow committed 2025-04-17 00:01:27 +02:00
1 parent 4cb5f7aa1f
commit d059f648fa
3 files changed
+6 -5

No files matched your search

@@ -1 +1,2 @@
add `console-exact_match` script-opt
make `console-case_sensitive` only affect exact searches and change the to default to no on platforms other than Windows
+2 -2
View File
@@ -206,9 +206,9 @@ Configurable Options
this option, prefixing queries with ``'`` enables exact matching.
``case_sensitive``
Default: no on Windows, yes on other platforms.
Default: no
Whether autocompletion is case sensitive. Only works with ASCII characters.
Whether exact searches are case sensitive. Only works with ASCII characters.
``history_dedup``
Default: true
+3 -3
View File
@@ -44,7 +44,7 @@ local opts = {
selected_back_color = "#FFFFFF",
match_color = "#0088FF",
exact_match = false,
case_sensitive = platform ~= "windows" and true or false,
case_sensitive = false,
history_dedup = true,
font_hw_ratio = "auto",
}
@@ -452,8 +452,8 @@ local function format_grid(list, width_max, rows_max)
return table.concat(rows, ass_escape("\n")), row_count
end
local function fuzzy_find(needle, haystacks, case_sensitive)
local result = require "mp.fzy".filter(needle, haystacks, case_sensitive)
local function fuzzy_find(needle, haystacks)
local result = require "mp.fzy".filter(needle, haystacks)
table.sort(result, function (i, j)
if i[3] ~= j[3] then
return i[3] > j[3]