Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

edit-command-line



Hi,

The function edit-command-line, which implements the ksh-like editing of the
command line using $EDITOR when v is hit, has a bug, which makes backslashes
escapes evaluated. You can try this by entering the command 

echo 'a\nb'

and hitting escape and v. You enter your $EDITOR, and when you leave it the
command is changed to

echo 'a
b'

which is of course wrong.

The following patch, which adds a -R (raw) option to a print, solves the
problem:

--- /usr/local/share/zsh/4.0.6/functions/edit-command-line.orig
2002-08-14 22:54:06.000000000 +0300
+++ /usr/local/share/zsh/4.0.6/functions/edit-command-line      2002-11-12
12:27:58.000000000 +0200
@@ -11,7 +11,7 @@
 print -R - "$PREBUFFER$BUFFER" >$tmpfile
 exec </dev/tty
 ${VISUAL:-${EDITOR:-vi}} $tmpfile
-print -z - "$(<$tmpfile)" 
+print -Rz - "$(<$tmpfile)" 
 
 command rm -f $tmpfile
 zle send-break         # Force reload from the buffer stack


Best,

Zvi.

-- 
Dr. Zvi Har'El     mailto:rl@xxxxxxxxxxxxxxxxxxx     Department of Mathematics
tel:+972-54-227607                   Technion - Israel Institute of Technology
fax:+972-4-8324654 http://www.math.technion.ac.il/~rl/     Haifa 32000, ISRAEL
"If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942)
                             Tuesday, 7 Kislev 5763, 12 November 2002, 12:32PM



Messages sorted by: Reverse Date, Date, Thread, Author