mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-15 23:11:26 +01:00
users/16932: implement $UNDO_CHANGE_NO and argument to undo widget
This commit is contained in:
parent
8bb9818cd4
commit
13a45d74eb
6 changed files with 59 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue