mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-30 15:21:16 -03:00
Escape separators (colon and equals) to improve completion
Fish completes parts of words split by the separators, so things like `dd if=/dev/sd<TAB>` work. This commit improves interactive completion if completion strings legitimately contain '=' or ':'. Consider this example where completion will suggest a:a:1 and other files in the cwd in addition to a:1 touch a:1; complete -C'ls a:' This behavior remains unchanged, but this commit allows to quote or escape separators, so that e.g. `ls "a:<TAB>` and `ls a\:<TAB>` successfully complete the filename. This also makes the completion insert those escapes automatically unless already quoted. So `ls a<TAB>` will give `ls a\:1`. Both changes match bash's behavior.
This commit is contained in:
committed by
ridiculousfish
parent
54ed2ad440
commit
f7dac82ed6
@@ -523,7 +523,8 @@ void parse_util_get_parameter_info(const wcstring &cmd, const size_t pos, wchar_
|
||||
wcstring parse_util_escape_string_with_quote(const wcstring &cmd, wchar_t quote, bool no_tilde) {
|
||||
wcstring result;
|
||||
if (quote == L'\0') {
|
||||
escape_flags_t flags = ESCAPE_ALL | ESCAPE_NO_QUOTED | (no_tilde ? ESCAPE_NO_TILDE : 0);
|
||||
escape_flags_t flags =
|
||||
ESCAPE_ALL | ESCAPE_NO_QUOTED | (no_tilde ? ESCAPE_NO_TILDE : 0) | ESCAPE_SEPARATORS;
|
||||
result = escape_string(cmd, flags);
|
||||
} else {
|
||||
// Here we are going to escape a string with quotes.
|
||||
|
||||
Reference in New Issue
Block a user