Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: edit-command-line
- X-seq: zsh-workers 11302
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: edit-command-line
- Date: Wed, 10 May 2000 15:13:31 +0000
- In-reply-to: <0FUC00L2BHP1Y5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <0FUC00L2BHP1Y5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On May 10, 2:05pm, Peter Stephenson wrote:
} Subject: PATCH: edit-command-line
}
} I think the LBUFFER= and RBUFFER= are redundant, I put them there while I
} was wondering why the display didn't appear properly after the function,
It looks like zrefresh() only reprints the line up to the previous cursor
position if it hasn't changed beyond that. The whole line gets redisplayed
correctly only if the cursor was at the start or end of the line when the
function began. So the call to redisplay is the right thing.
Fiddling with LBUFFER and RBUFFER causes CURSOR to change, though, so I
think we should take those out and explicitly set CURSOR instead.
And being me, I rewrote other stuff as well: Quote against shwordsplit,
use `print -R -' in case of backslashes or leading dashes in $BUFFER, and
don't let the user's alias for `rm' creep in.
Index: Functions/Zle/edit-command-line
===================================================================
@@ -7,12 +7,11 @@
local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$
-print $BUFFER >$tmpfile
+print -R - "$BUFFER" >$tmpfile
exec </dev/tty
${VISUAL:-${EDITOR:-vi}} $tmpfile
-LBUFFER=
-RBUFFER=
-BUFFER=$(<$tmpfile)
+BUFFER="$(<$tmpfile)"
+CURSOR=$#BUFFER
-rm -f $tmpfile
+command rm -f $tmpfile
zle redisplay
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author