about summary refs log tree commit diff
path: root/Functions/Zle
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2001-02-14 15:37:53 +0000
committerClint Adams <clint@users.sourceforge.net>2001-02-14 15:37:53 +0000
commit39ab4f33c677ec3f28ce58359f5e7ac986b1534f (patch)
treee881dc47ad8adaea780faea187440eff4167fa26 /Functions/Zle
parent5d60b669447a7229cd96bdbcdb1573cc04fe89a9 (diff)
downloadzsh-39ab4f33c677ec3f28ce58359f5e7ac986b1534f.tar.gz
zsh-39ab4f33c677ec3f28ce58359f5e7ac986b1534f.tar.xz
zsh-39ab4f33c677ec3f28ce58359f5e7ac986b1534f.zip
13323: handle multi-line buffers in edit-command-line widget
Diffstat (limited to 'Functions/Zle')
-rw-r--r--Functions/Zle/edit-command-line9
1 files changed, 6 insertions, 3 deletions
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index ab2134caf..89ce6741b 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -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
+