diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2015-08-17 20:59:00 -0700 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2015-08-17 20:59:00 -0700 |
commit | c239a7bd91d8cfdc8b8aaf42059add04ba4c16c2 (patch) | |
tree | 4f65521325be42d9873183c42921a9115eefbe13 /Functions | |
parent | 9a369d39e13787c376c57713ab8c14e5c0f4bfb8 (diff) | |
download | zsh-c239a7bd91d8cfdc8b8aaf42059add04ba4c16c2.tar.gz zsh-c239a7bd91d8cfdc8b8aaf42059add04ba4c16c2.tar.xz zsh-c239a7bd91d8cfdc8b8aaf42059add04ba4c16c2.zip |
36212: save and restore HISTNO along with other editor state, for sanity of "zle undo"
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Zle/narrow-to-region | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Functions/Zle/narrow-to-region b/Functions/Zle/narrow-to-region index 0ef28a8dc..261d821a9 100644 --- a/Functions/Zle/narrow-to-region +++ b/Functions/Zle/narrow-to-region @@ -32,7 +32,7 @@ setopt localoptions noshwordsplit noksharrays local _ntr_newbuf _ntr_lbuf_return _ntr_rbuf_return local _ntr_predisplay=$PREDISPLAY _ntr_postdisplay=$POSTDISPLAY -integer _ntr_savelim=UNDO_LIMIT_NO _ntr_changeno +integer _ntr_savelim=UNDO_LIMIT_NO _ntr_changeno _ntr_histno=HISTNO integer _ntr_start _ntr_end _ntr_swap _ntr_cursor=$CURSOR _ntr_mark=$MARK integer _ntr_stat @@ -108,7 +108,7 @@ if [[ -n $_ntr_save || -z $_ntr_restore ]]; then builtin typeset -ga $_ntr_save set -A $_ntr_save "${_ntr_predisplay}" "${_ntr_postdisplay}" \ "${_ntr_savelim}" "${_ntr_changeno}" \ - "${_ntr_start}" "${_ntr_end}" || return 1 + "${_ntr_start}" "${_ntr_end}" "${_ntr_histno}" || return 1 fi BUFFER=${BUFFER[_ntr_start+1,_ntr_end]} @@ -135,13 +135,15 @@ if [[ -n $_ntr_restore || -z $_ntr_save ]]; then _ntr_savelim="${${(@P)_ntr_restore}[3]}" _ntr_changeno="${${(@P)_ntr_restore}[4]}" _ntr_start="${${(@P)_ntr_restore}[5]}" - _ntr_end="${${(@P)_ntr_restore}[6]}" }; then + _ntr_end="${${(@P)_ntr_restore}[6]}" + _ntr_histno="${${(@P)_ntr_restore}[7]}" }; then zle -M Failed. >&2 return 1 fi fi _ntr_newbuf="$BUFFER" + HISTNO=_ntr_histno zle undo $_ntr_changeno PREDISPLAY=$_ntr_predisplay POSTDISPLAY=$_ntr_postdisplay |