about summary refs log tree commit diff
path: root/Functions/Zle/replace-string
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-03-29 20:31:33 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-03-29 20:31:33 +0000
commit13a45d74eb246894516aa9315622cf99d7f27697 (patch)
tree680a07a1d9c4215c050b41e89c9bf1d7f3491e95 /Functions/Zle/replace-string
parent8bb9818cd403092830896c7c7dd02e3ccd744213 (diff)
downloadzsh-13a45d74eb246894516aa9315622cf99d7f27697.tar.gz
zsh-13a45d74eb246894516aa9315622cf99d7f27697.tar.xz
zsh-13a45d74eb246894516aa9315622cf99d7f27697.zip
users/16932: implement $UNDO_CHANGE_NO and argument to undo widget
Diffstat (limited to 'Functions/Zle/replace-string')
-rw-r--r--Functions/Zle/replace-string9
1 files changed, 9 insertions, 0 deletions
diff --git a/Functions/Zle/replace-string b/Functions/Zle/replace-string
index a3416a403..68aac28d2 100644
--- a/Functions/Zle/replace-string
+++ b/Functions/Zle/replace-string
@@ -4,6 +4,9 @@ setopt extendedglob
 autoload -Uz read-from-minibuffer replace-string-again
 
 local p1  p2
+integer changeno=$UNDO_CHANGE_NO
+
+{
 
 if [[ -n $_replace_string_src ]]; then
   p1="[$_replace_string_src -> $_replace_string_rep]"$'\n'
@@ -30,4 +33,10 @@ if [[ -n $REPLY ]]; then
   typeset -g _replace_string_rep=$REPLY
 fi
 
+} always {
+  # Undo back to the original line; we don't want the
+  # undo history of editing the strings left.
+  zle undo $changeno
+}
+
 replace-string-again $curwidget