mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-16 02:32:11 +02:00
13323: handle multi-line buffers in edit-command-line widget
This commit is contained in:
parent
5d60b66944
commit
39ab4f33c6
2 changed files with 10 additions and 3 deletions
|
@ -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>
|
2001-02-02 Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,18 @@
|
||||||
# autoload edit-command-line
|
# autoload edit-command-line
|
||||||
# zle -N edit-command-line
|
# zle -N edit-command-line
|
||||||
# bindkey -M vicmd v 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$$
|
local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$
|
||||||
|
|
||||||
print -R - "$BUFFER" >$tmpfile
|
print -R - "$PREBUFFER$BUFFER" >$tmpfile
|
||||||
exec </dev/tty
|
exec </dev/tty
|
||||||
${VISUAL:-${EDITOR:-vi}} $tmpfile
|
${VISUAL:-${EDITOR:-vi}} $tmpfile
|
||||||
BUFFER="$(<$tmpfile)"
|
zle kill-buffer
|
||||||
|
BUFFER=${"$(<$tmpfile)"/$PREBUFFER/}
|
||||||
CURSOR=$#BUFFER
|
CURSOR=$#BUFFER
|
||||||
|
|
||||||
command rm -f $tmpfile
|
command rm -f $tmpfile
|
||||||
zle redisplay
|
zle redisplay
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue