diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2015-06-14 20:12:42 -0700 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2015-06-14 20:12:42 -0700 |
commit | 9f3dc6605aa049e689f769dd2b4a864361c92b1d (patch) | |
tree | 76300c7dc94e13d0c981e46460be2562e22c9a67 | |
parent | 806f73a0b3d3959d5af12ce97e0258b4d4fe7d76 (diff) | |
download | zsh-9f3dc6605aa049e689f769dd2b4a864361c92b1d.tar.gz zsh-9f3dc6605aa049e689f769dd2b4a864361c92b1d.tar.xz zsh-9f3dc6605aa049e689f769dd2b4a864361c92b1d.zip |
35469: test UNDO_CHANGE_NO to determine whether to start over or use the next history event
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Functions/Zle/smart-insert-last-word | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index f297a0b17..17fd01237 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-06-14 Barton E. Schaefer <schaefer@zsh.org> + * 35469: Functions/Zle/smart-insert-last-word: test UNDO_CHANGE_NO + to determine whether to start over or use the next history event + * 35467: Completion/Unix/Command/_du: complete files for non-GNU du 2015-06-12 Peter Stephenson <p.stephenson@samsung.com> 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 |