From 206ea15b68c0a6677d1f4eb3d5f978fbaef42606 Mon Sep 17 00:00:00 2001 From: David Adam Date: Sun, 16 Nov 2014 23:05:55 +0800 Subject: [PATCH] abbr.fish: improve support for corner cases Handle unusual cases ('=abc', ' =abc') better - regression from 8e8e6314due to a7bab7b. Work on #731. --- share/functions/abbr.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/functions/abbr.fish b/share/functions/abbr.fish index 2339ca442..fdb6d6ae9 100644 --- a/share/functions/abbr.fish +++ b/share/functions/abbr.fish @@ -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