1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-24 05:11:08 +02:00

43755: Fix state management for repeat uses to avoid clobbering command line when NOT a repeat

This commit is contained in:
Bart Schaefer 2019-07-08 18:01:38 -07:00
parent 5415e1d4df
commit cf66eb7adb
2 changed files with 7 additions and 2 deletions

View file

@ -1,5 +1,9 @@
2019-07-08 Bart Schaefer <schaefer@brasslantern.com>
* 43755: Functions/Zle/smart-insert-last-word: (Belated commit)
Fix state management for repeat uses to avoid clobbering command
line when NOT a repeat
* 44502: Src/builtin.c: Quote function name for "autoload -X"
* 44495: Doc/Zsh/params.yo: Mention coproc under $!

View file

@ -48,13 +48,14 @@ zle auto-suffix-retain
# Not strictly necessary:
# (($+_ilw_hist)) || integer -g _ilw_hist _ilw_count _ilw_cursor _ilw_lcursor _ilw_changeno
# (($+_ilw_result)) || typeset -g _ilw_result
integer cursor=$CURSOR lcursor=$CURSOR
local lastcmd pattern numeric=$NUMERIC
# Save state for repeated calls
if (( HISTNO == _ilw_hist && cursor == _ilw_cursor &&
UNDO_CHANGE_NO == _ilw_changeno ))
UNDO_CHANGE_NO == _ilw_changeno )) && [[ $BUFFER == $_ilw_result ]]
then
NUMERIC=$[_ilw_count+1]
lcursor=$_ilw_lcursor
@ -119,7 +120,7 @@ fi
(( NUMERIC > $#lastcmd )) && return 1
LBUFFER[lcursor+1,cursor+1]=$lastcmd[-NUMERIC]
typeset -g _ilw_cursor=$CURSOR
typeset -g _ilw_cursor=$CURSOR _ilw_result=$BUFFER
# This is necessary to update UNDO_CHANGE_NO immediately
zle split-undo && typeset -g _ilw_changeno=$UNDO_CHANGE_NO