mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
37570: give truth to the doc assertion transpose-words-match is a drop-in replacement for transpose-words
This commit is contained in:
parent
c275839033
commit
4a30b542a0
2 changed files with 13 additions and 1 deletions
|
@ -5,6 +5,9 @@
|
|||
|
||||
2016-01-13 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 37570: Functions/Zle/transpose-words-match: give truth to the
|
||||
doc assertion this is a drop-in replacement for transpose-words
|
||||
|
||||
* 37567: Functions/Zle/match-words-by-style: use (Z:n:) to split
|
||||
the buffer into words so line breaks are treated as whitespace
|
||||
|
||||
|
|
|
@ -11,14 +11,23 @@
|
|||
# on X would be turned into `barXfoo' with the cursor still on the X,
|
||||
# regardless of what the character X is.
|
||||
|
||||
emulate -L zsh
|
||||
autoload -Uz match-words-by-style
|
||||
|
||||
local curcontext=":zle:$WIDGET" skip
|
||||
local curcontext=":zle:$WIDGET"
|
||||
local -a matched_words
|
||||
integer count=${NUMERIC:-1} neg
|
||||
|
||||
(( count < 0 )) && (( count = -count, neg = 1 ))
|
||||
|
||||
if [[ $WIDGET == transpose-words ]]; then
|
||||
# default is to be a drop-in replacement, check styles for change
|
||||
zstyle -m $curcontext skip-chars \* ||
|
||||
zstyle -m $curcontext word-style '*subword*' ||
|
||||
{ [[ $LBUFFER[-1] != [[:space:]] && $RBUFFER[1] != [[:space:]] ||
|
||||
-z ${RBUFFER//[[:space:]]/} ]] && zle backward-word }
|
||||
fi
|
||||
|
||||
while (( count-- > 0 )); do
|
||||
match-words-by-style
|
||||
|
||||
|
|
Loading…
Reference in a new issue