summaryrefslogtreecommitdiff
path: root/Functions/Zle/smart-insert-last-word
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2015-08-22 01:55:58 +0200
committerAxel Beckert <abe@deuxchevaux.org>2015-08-22 01:55:58 +0200
commit02f6e25bfcd5feb9a093377dda0dd549cdf5c309 (patch)
tree9a25e61122b3fa0d0a1ff68b5ef05c775ff78b1e /Functions/Zle/smart-insert-last-word
parente04a19735ffc8523b93b33074f685ad4e2c92e0c (diff)
parent881474edcb223ac22a08d81a824809c33ca3a9c9 (diff)
downloadzsh-02f6e25bfcd5feb9a093377dda0dd549cdf5c309.tar.gz
zsh-02f6e25bfcd5feb9a093377dda0dd549cdf5c309.zip
Merge tag 'zsh-5.0.8-test-2' into debian
Diffstat (limited to 'Functions/Zle/smart-insert-last-word')
-rw-r--r--Functions/Zle/smart-insert-last-word12
1 files changed, 9 insertions, 3 deletions
diff --git a/Functions/Zle/smart-insert-last-word b/Functions/Zle/smart-insert-last-word
index 27b0849ee..67adea760 100644
--- a/Functions/Zle/smart-insert-last-word
+++ b/Functions/Zle/smart-insert-last-word
@@ -47,13 +47,15 @@ setopt extendedglob nohistignoredups
zle auto-suffix-retain
# Not strictly necessary:
-# (($+_ilw_hist)) || integer -g _ilw_hist _ilw_count _ilw_cursor _ilw_lcursor
+# (($+_ilw_hist)) || integer -g _ilw_hist _ilw_count _ilw_cursor _ilw_lcursor _ilw_changeno
integer cursor=$CURSOR lcursor=$CURSOR
local lastcmd pattern numeric=$NUMERIC
# Save state for repeated calls
-if (( HISTNO == _ilw_hist && cursor == _ilw_cursor )); then
+if (( HISTNO == _ilw_hist && cursor == _ilw_cursor &&
+ UNDO_CHANGE_NO == _ilw_changeno ))
+then
NUMERIC=$[_ilw_count+1]
lcursor=$_ilw_lcursor
else
@@ -61,7 +63,8 @@ else
_ilw_lcursor=$lcursor
fi
# Handle the up to three arguments of .insert-last-word
-if (( $+1 )); then
+if (( $+1 ))
+then
if (( $+3 )); then
((NUMERIC = -($1)))
else
@@ -117,3 +120,6 @@ fi
LBUFFER[lcursor+1,cursor+1]=$lastcmd[-NUMERIC]
_ilw_cursor=$CURSOR
+
+# This is necessary to update UNDO_CHANGE_NO immediately
+zle split-undo && _ilw_changeno=$UNDO_CHANGE_NO