mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-11 12:55:27 +08:00

File names that have lots of spaces look quite ugly when inserted as completions because every space will have a backslash. Add an initial heuristic to decide when to use quotes instead of backslash escapes. Quote when 1. it's not an autosuggestion 2. we replace the token or insert a fresh one 3. we will add a space at the end In future we could relax some of these requirements. Requirement 2 means we don't quote when appending to an existing token. Need to find a natural behavior here. Re 3, if the completion adds no space, users will probably want to add more characters, which looks a bit weird if the token has a trailing quote. We could relax this requirement for directory completions, so «ls so» completes to «ls 'some dir with spaces'/». Closes #5433