From 13a45d74eb246894516aa9315622cf99d7f27697 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 29 Mar 2012 20:31:33 +0000 Subject: users/16932: implement $UNDO_CHANGE_NO and argument to undo widget --- Functions/Zle/replace-string | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Functions') 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 -- cgit 1.4.1