carapace-sh/carapace

bash: file completion - additional tilde prefix added

rsteube opened this issue · 1 comments

Current Behavior

Tab completing an open quoted path with tilde adds another one:

mv ~"/Downloads/with space<TAB>
# mv ~"~"/Downloads/with space" 

Expected Behavior

Not add another ~

Steps To Reproduce

No response

Version

0.45.0

OS

  • Linux
  • OSX
  • Windows

Shell

  • Bash
  • Elvish
  • Fish
  • Nushell
  • Oil
  • Powershell
  • Xonsh
  • Zsh

Anything else?

2023/12/02 20:59:36.723484 bash --------------------------------------------------------------------------------
2023/12/02 20:59:36.723536 bash []string{"carapace", "_carapace", "bash", "mv", "~/Downloads/w"}
2023/12/02 20:59:36.723622 bash COMPLINE "mv ~/Downloads/w"
2023/12/02 20:59:36.723656 bash patching args to []string{"bash", "mv", "~/Downloads/w"}
2023/12/02 20:59:36.723658 bash traverse called for "mv" with args []string{"~/Downloads/w"}
2023/12/02 20:59:36.723661 bash executing PreRun for "mv" with args []string{"~/Downloads/w"}
2023/12/02 20:59:36.723693 bash parsing flags for "mv" with args []string{}
2023/12/02 20:59:36.723696 bash completing positionals and subcommands for arg "~/Downloads/w"
false~"/Downloads/with space"
2023/12/02 20:59:42.023471 bash --------------------------------------------------------------------------------
2023/12/02 20:59:42.023531 bash []string{"carapace", "_carapace", "bash", "mv", "~/Downloads/with spac"}
2023/12/02 20:59:42.023632 bash COMPLINE "mv ~\"/Downloads/with spac"
2023/12/02 20:59:42.023666 bash patching args to []string{"bash", "mv", "~/Downloads/with spac"}
2023/12/02 20:59:42.023669 bash traverse called for "mv" with args []string{"~/Downloads/with spac"}
2023/12/02 20:59:42.023671 bash executing PreRun for "mv" with args []string{"~/Downloads/with spac"}
2023/12/02 20:59:42.023708 bash parsing flags for "mv" with args []string{}
2023/12/02 20:59:42.023710 bash completing positionals and subcommands for arg "~/Downloads/with spac"
false~"/Downloads/with space"

related #947

Should be an issue in carapace-shlex not correctly handling open quotes.

Looks like bash considers an open quote as wordbreak so anything before it won't be replaced.