diff options
| author | Peter Stephenson <pws@users.sourceforge.net> | 2003-04-03 10:24:40 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@users.sourceforge.net> | 2003-04-03 10:24:40 +0000 |
| commit | f713bf4b090214856eb3b0d1596dfa30271b3a2d (patch) | |
| tree | 5d4927d2d695bfb9c1a290aa5016d758c933387c /Functions/Zle | |
| parent | unposted: tidy up after word match functions from 18394 (diff) | |
| download | zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.tar zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.tar.gz zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.tar.bz2 zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.tar.lz zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.tar.xz zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.tar.zst zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.zip | |
18432: Minor miscellany of comments and rationalisations.
Diffstat (limited to 'Functions/Zle')
| -rw-r--r-- | Functions/Zle/transpose-words-match | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Functions/Zle/transpose-words-match b/Functions/Zle/transpose-words-match index 52891b6ac..6fb60a01d 100644 --- a/Functions/Zle/transpose-words-match +++ b/Functions/Zle/transpose-words-match @@ -15,16 +15,24 @@ autoload match-words-by-style local curcontext=":zle:$WIDGET" skip local -a matched_words -integer count=${NUMERIC:-1} +integer count=${NUMERIC:-1} neg + +(( count < 0 )) && (( count = -count, neg = 1 )) while (( count-- > 0 )); do match-words-by-style [[ -z "$matched_words[2]$matched_words[5]" ]] && return 1 - LBUFFER="$matched_words[1]$matched_words[5]${(j..)matched_words[3,4]}\ + if (( neg )); then + LBUFFER="$matched_words[1]" + RBUFFER="$matched_words[5]${(j..)matched_words[3,4]}\ +$matched_words[2]${(j..)matched_words[6,7]}" + else + LBUFFER="$matched_words[1]$matched_words[5]${(j..)matched_words[3,4]}\ $matched_words[2]" - RBUFFER="${(j..)matched_words[6,7]}" + RBUFFER="${(j..)matched_words[6,7]}" + fi done |
