mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
__fish_complete_suffix: replace prefix only at start
This commit is contained in:
parent
b7bd7e9916
commit
0dd334ee46
1 changed files with 2 additions and 3 deletions
|
@ -89,9 +89,8 @@ function __fish_complete_suffix -d "Complete using files"
|
|||
set desc "\t$desc"
|
||||
end
|
||||
if string match -qr -- . "$prefix"
|
||||
# Ideally, only replace in the beginning of the string, but we have no
|
||||
# way of doing a pcre2 escape so we can use a regex replace instead
|
||||
set files (string replace $prefix "" $files)
|
||||
set prefix (string escape --style=regex -- $prefix)
|
||||
set files (string replace -r -- "^$prefix" "" $files)
|
||||
end
|
||||
printf "%s$desc\n" $files
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue