From cf66eb7adbff8284a66bccd013c30120fa3ad695 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 8 Jul 2019 18:01:38 -0700 Subject: 43755: Fix state management for repeat uses to avoid clobbering command line when NOT a repeat --- ChangeLog | 4 ++++ Functions/Zle/smart-insert-last-word | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a73ab744c..ab663ccf5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2019-07-08 Bart Schaefer + * 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 $! diff --git a/Functions/Zle/smart-insert-last-word b/Functions/Zle/smart-insert-last-word index cf8715dfe..05f23cba6 100644 --- a/Functions/Zle/smart-insert-last-word +++ b/Functions/Zle/smart-insert-last-word @@ -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 -- cgit 1.4.1