mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Fix replacing completions spuriously quoting ~
Commit29dc30711
(Insert some completions with quotes instead of backslashes, 2024-04-13) wrongly copmletes $ cat ~/space to $ cat '~/path with spaces' Today completions can be either replacing or appending. We never quote (but backslash-escape) appending completions (unless they "append" to an empty token). We always quote replacing completions. The assumption in this part of the code is that replacing completions can be quoted without changing meaning. This assumption is wrong for tildes. For the backslash-escaping code path, we take care of this edge case via a special DONT_ESCAPE_TILDES flag. However that flag does not take effect when using quotes for escaping. Fix that. Unfortunately,e97a4fab7
(Escape : and = in file completions, 2024-04-19) introduced a (hopefully temporary) code clone in escape_separators, which made added an extra step to debugging here.
This commit is contained in:
parent
99b5e6e0e7
commit
421ce13be6
2 changed files with 14 additions and 1 deletions
|
@ -196,7 +196,7 @@ fn escape_string_script(input: &wstr, flags: EscapeFlags) -> WString {
|
|||
);
|
||||
|
||||
let mut need_escape = false;
|
||||
let mut need_complex_escape = false;
|
||||
let mut need_complex_escape = no_tilde && input.char_at(0) == '~';
|
||||
let mut double_quotes = 0;
|
||||
let mut single_quotes = 0;
|
||||
let mut dollars = 0;
|
||||
|
|
13
tests/checks/tmux-complete2.fish
Normal file
13
tests/checks/tmux-complete2.fish
Normal file
|
@ -0,0 +1,13 @@
|
|||
#RUN: %fish %s
|
||||
#REQUIRES: command -v tmux
|
||||
#REQUIRES: uname -r | grep -qv Microsoft
|
||||
# cautiously disable because tmux-complete.fish is disabled
|
||||
#REQUIRES: test -z "$CI"
|
||||
|
||||
isolated-tmux-start
|
||||
|
||||
isolated-tmux send-keys 'touch ~/"path with spaces"' Enter C-l \
|
||||
'cat ~/space' Tab
|
||||
tmux-sleep
|
||||
isolated-tmux capture-pane -p
|
||||
# CHECK: prompt 1> cat ~/path\ with\ spaces
|
Loading…
Reference in a new issue