0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

console: enable completions without a prefix

This way it is possible to get a list of all options or all properties,
instead of having to guess the first letter before any suggestions are
shown.
This commit is contained in:
Christoph Heinrich 2023-09-27 21:31:58 +02:00 committed by Dudemanguy
parent 386de3f275
commit bca0b20c09

View File

@ -756,7 +756,7 @@ end
-- match.
function build_completers()
local completers = {
{ pattern = '^%s*()[%w_-]+$', list = command_list_and_help, append = ' ' },
{ pattern = '^%s*()[%w_-]*$', list = command_list_and_help, append = ' ' },
{ pattern = '^%s*help%s+()[%w_-]*$', list = command_list },
{ pattern = '^%s*set%s+"?([%w_-]+)"?%s+()%S*$', list = choice_list },
{ pattern = '^%s*set%s+"?([%w_-]+)"?%s+"()%S*$', list = choice_list, append = '"' },
@ -770,17 +770,17 @@ function build_completers()
{ pattern = '^%s*change[-_]list%s+"?([%w_-]+)"?%s+"()%a*$', list = list_option_verb_list, append = '" ' },
{ pattern = '^%s*([av]f)%s+()%a*$', list = list_option_verb_list, append = ' ' },
{ pattern = '^%s*([av]f)%s+"()%a*$', list = list_option_verb_list, append = '" ' },
{ pattern = '${=?()[%w_/-]+$', list = property_list, append = '}' },
{ pattern = '${=?()[%w_/-]*$', list = property_list, append = '}' },
}
for _, command in pairs({'set', 'add', 'cycle', 'cycle[-_]values', 'multiply'}) do
completers[#completers + 1] = {
pattern = '^%s*' .. command .. '%s+()[%w_/-]+$',
pattern = '^%s*' .. command .. '%s+()[%w_/-]*$',
list = property_list,
append = ' ',
}
completers[#completers + 1] = {
pattern = '^%s*' .. command .. '%s+"()[%w_/-]+$',
pattern = '^%s*' .. command .. '%s+"()[%w_/-]*$',
list = property_list,
append = '" ',
}