console.lua: fix completing empty --dscale and --cscale

These options accept an empty value within their choices. If the user
didn't add manually input a quote before completing them, add quotes
automatically so that the blank value can actually be used.
This commit is contained in:
Guido Cella 2024-09-14 16:47:07 +02:00 committed by Kacper Michajłow
parent dd77d0a7da
commit 7362f72fdf
1 changed files with 5 additions and 0 deletions

View File

@ -1220,6 +1220,11 @@ local function handle_choice_completion(option, before_cur, path_pos)
return handle_file_completion(before_cur, path_pos) return handle_file_completion(before_cur, path_pos)
end end
-- Fix completing the empty value for --dscale and --cscale.
if info.choices and info.choices[1] == '' and completion_append == '' then
info.choices[1] = '""'
end
return info.choices, before_cur return info.choices, before_cur
end end