Fix __fish_complete_suffix behavior for paths with literal .

__fish_complete_suffix assumed that the only literal . in a path
would be the . before an extension, and stripped accordingly. This
behavior has been there for a long time, but broke many things
including completion of relative paths and completion of paths with
a literal . in a directory name.

__fish_complete_suffix does not just complete extensions (or at the
very least, it no longer does just that) but rather any suffix, so
isolating the path name without the extension was unnecessary in all
cases.
This commit is contained in:
Mahmoud Al-Qudsi 2018-06-25 13:53:18 -05:00
parent cbdd347ec6
commit 72d80c3d91

View file

@ -35,11 +35,9 @@ function __fish_complete_suffix -d "Complete using files"
# Strip leading ./ as it confuses the detection of base and suffix
# It is conditionally re-added below.
set -l base_temp (string replace -r '^\\./' '' -- $comp)
set base (string replace -r '\\.[^.]*$' '' -- $base_temp | string trim -c '\'"') # " make emacs syntax highlighting happy
# echo "base: $base" > /dev/tty
# echo "suffix: $suff" > /dev/tty
set base (string replace -r '^("\')?\\./' '' -- $comp | string trim -c '\'"') # " make emacs syntax highlighting happy
echo "base: $base" > /dev/tty
echo "suffix: $suff" > /dev/tty
set -l all
set -l dirs