Skip to content

Commit

Permalink
edge case $(($(alias)))
Browse files Browse the repository at this point in the history
  • Loading branch information
MenkeTechnologies committed Dec 11, 2021
1 parent b6f6713 commit 3c268aa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions zpwrExpandApi.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ function zpwrExpandParseWords(){
tmp=${1}
tmp=( ${(z)tmp} )

# arithmetic expansion $(()) is not a a command position so replace with junk value
tmp[-1]=${tmp[-1]//[\$]\(\(/no_cmd_$RANDOM}
# change <(, =(, $( to ; for word splitting
tmp[-1]=${tmp[-1]//[\<\=\$]\(/;}
# change ` to ; for word splitting
Expand Down Expand Up @@ -92,7 +94,7 @@ function zpwrExpandParseWords(){

function zpwrExpandLastWordAtCommandPosAndExpand(){

local moveCursor=$1
local cursorAction=$1
local caller=$2
local triggerKey=$3

Expand All @@ -109,7 +111,7 @@ function zpwrExpandLastWordAtCommandPosAndExpand(){
fi
zpwrExpandAlias
fi
if [[ $ZPWR_VARS[WAS_EXPANDED] == true && $moveCursor == moveCursor ]]; then
if [[ $ZPWR_VARS[WAS_EXPANDED] == true && $cursorAction == moveCursor ]]; then
zpwrExpandGoToTabStopOrEndOfLBuffer
fi
fi
Expand All @@ -131,7 +133,7 @@ function zpwrExpandLastWordAtCommandPosAndExpand(){
if [[ $caller == zle ]]; then
zpwrExpandGetAliasValue
zpwrExpandAlias
if [[ $ZPWR_VARS[WAS_EXPANDED] == true && $moveCursor == moveCursor && $triggerKey != "${ZPWR_VARS[ENTER_KEY]}" ]]; then
if [[ $ZPWR_VARS[WAS_EXPANDED] == true && $cursorAction == moveCursor && $triggerKey != "${ZPWR_VARS[ENTER_KEY]}" ]]; then
zpwrExpandGoToTabStopOrEndOfLBuffer
fi
fi
Expand Down

0 comments on commit 3c268aa

Please sign in to comment.