From 30216ba7ba6aa0cd09df9c57931e719a6d643cc6 Mon Sep 17 00:00:00 2001 From: Henry Bley-Vroman Date: Sun, 19 Dec 2021 14:49:53 -1000 Subject: [PATCH] fix(erase): erases abbreviation (quote level correction) --- zsh-abbr.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zsh-abbr.zsh b/zsh-abbr.zsh index b89a72fd..1d9a7a8e 100755 --- a/zsh-abbr.zsh +++ b/zsh-abbr.zsh @@ -102,7 +102,7 @@ _abbr() { abbreviation=${(q)abbreviation} expansion=${(q)expansion} fi - + if [[ -z $abbreviation || -z $expansion || $abbreviation == $1 ]]; then _abbr:util_error "abbr add: Requires abbreviation and expansion" return @@ -144,14 +144,14 @@ _abbr() { if [[ $scope != 'user' ]]; then if [[ $type != 'regular' ]]; then - if (( ${+ABBR_GLOBAL_SESSION_ABBREVIATIONS[$abbreviation]} )); then + if (( ${+ABBR_GLOBAL_SESSION_ABBREVIATIONS[${(qqq)abbreviation}]} )); then (( ABBR_DEBUG )) && 'builtin' 'echo' " Found a global session abbreviation" abbreviations_sets+=( ABBR_GLOBAL_SESSION_ABBREVIATIONS ) fi fi if [[ $type != 'global' ]]; then - if (( ${+ABBR_REGULAR_SESSION_ABBREVIATIONS[$abbreviation]} )); then + if (( ${+ABBR_REGULAR_SESSION_ABBREVIATIONS[${(qqq)abbreviation}]} )); then (( ABBR_DEBUG )) && 'builtin' 'echo' " Found a regular session abbreviation" abbreviations_sets+=( ABBR_REGULAR_SESSION_ABBREVIATIONS ) fi @@ -164,7 +164,7 @@ _abbr() { source ${ABBR_TMPDIR}global-user-abbreviations fi - if (( ${+ABBR_GLOBAL_USER_ABBREVIATIONS[$abbreviation]} )); then + if (( ${+ABBR_GLOBAL_USER_ABBREVIATIONS[${(qqq)abbreviation}]} )); then (( ABBR_DEBUG )) && 'builtin' 'echo' " Found a global user abbreviation" abbreviations_sets+=( ABBR_GLOBAL_USER_ABBREVIATIONS ) fi @@ -175,7 +175,7 @@ _abbr() { source ${ABBR_TMPDIR}regular-user-abbreviations fi - if (( ${+ABBR_REGULAR_USER_ABBREVIATIONS[$abbreviation]} )); then + if (( ${+ABBR_REGULAR_USER_ABBREVIATIONS[${(qqq)abbreviation}]} )); then (( ABBR_DEBUG )) && 'builtin' 'echo' " Found a regular user abbreviation" abbreviations_sets+=( ABBR_REGULAR_USER_ABBREVIATIONS ) fi @@ -189,7 +189,7 @@ _abbr() { if ! (( dry_run )); then verb_phrase="Erased" - unset "${abbreviations_sets}[${(b)abbreviation}]" # quotation marks required + unset "${abbreviations_sets}[${(b)${(qqq)abbreviation}}]" # quotation marks required if [[ $abbreviations_sets =~ USER ]]; then _abbr:util_sync_user