Skip to content

Commit

Permalink
fix(erase): erases abbreviation (quote level correction)
Browse files Browse the repository at this point in the history
  • Loading branch information
olets committed Nov 10, 2022
1 parent b36eee2 commit 30216ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions zsh-abbr.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 30216ba

Please sign in to comment.