13323: handle multi-line buffers in edit-command-line widget

This commit is contained in:
Clint Adams 2001-02-14 15:37:53 +00:00
parent 5d60b66944
commit 39ab4f33c6
2 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,7 @@
2001-02-14 Clint Adams <schizo@debian.org>
* 13323: Functions/Zle/edit-command-line: handle
multi-line buffers.
2001-02-02 Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>

View file

@ -3,15 +3,18 @@
# autoload edit-command-line
# zle -N edit-command-line
# bindkey -M vicmd v edit-command-line
# will give ksh-like behaviour for that key.
# will give ksh-like behaviour for that key,
# except that it will handle multi-line buffers properly.
local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$
print -R - "$BUFFER" >$tmpfile
print -R - "$PREBUFFER$BUFFER" >$tmpfile
exec </dev/tty
${VISUAL:-${EDITOR:-vi}} $tmpfile
BUFFER="$(<$tmpfile)"
zle kill-buffer
BUFFER=${"$(<$tmpfile)"/$PREBUFFER/}
CURSOR=$#BUFFER
command rm -f $tmpfile
zle redisplay