1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-22 16:20:23 +02:00

32866: new replace-argument ZLE function.

Also a couple of read-from-minibuffer fixes: don't pass numeric
argument to recursive edit, and hide the minibuffer edit from
the undo history.
This commit is contained in:
Peter Stephenson 2014-07-17 09:45:46 +01:00
parent 7d5db0d277
commit 4e54648add
4 changed files with 89 additions and 0 deletions

View file

@ -20,7 +20,9 @@ done
(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
local readprompt="$1" lbuf_init="$2" rbuf_init="$3"
integer changeno=$UNDO_CHANGE_NO
{
# Use anonymous function to make sure special values get restored,
# even if this function is called as a widget.
# local +h ensures special parameters stay special.
@ -39,10 +41,17 @@ local readprompt="$1" lbuf_init="$2" rbuf_init="$3"
read -k $keys
stat=$?
else
local NUMERIC
unset NUMERIC
zle recursive-edit -K main
stat=$?
(( stat )) || REPLY=$BUFFER
fi
}
} always {
# This removes the edits relating to the read from the undo history.
# These aren't useful once we get back to the main editing buffer.
zle undo $changeno
}
return $stat