mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
abbr.fish: improve support for corner cases
Handle unusual cases ('=abc', ' =abc') better - regression from
8e8e6314due to a7bab7b
.
Work on #731.
This commit is contained in:
parent
a7bab7b18b
commit
206ea15b68
1 changed files with 5 additions and 1 deletions
|
@ -143,15 +143,19 @@ function __fish_abbr_parse_entry -S -a __input __key __value
|
|||
if test -z "$__value"
|
||||
set __value _
|
||||
end
|
||||
set -l IFS '= '
|
||||
switch $__input
|
||||
case '=*'
|
||||
# read will skip any leading ='s, but we don't want that
|
||||
set __input " $__input"
|
||||
set __key _
|
||||
set IFS '='
|
||||
case ' =*'
|
||||
set __key _
|
||||
set IFS '='
|
||||
end
|
||||
# use read -z to avoid splitting on newlines
|
||||
# I think we can safely assume there will be no NULs in the input
|
||||
set -l IFS '= '
|
||||
printf "%s" $__input | read -z $__key $__value
|
||||
return 0
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue