zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Don't store ZLE_LINE_ABORTED in vared context
@ 2015-03-04 18:40 Mikael Magnusson
  2015-03-05  1:57 ` Bart Schaefer
  2015-03-05  9:59 ` Peter Stephenson
  0 siblings, 2 replies; 8+ messages in thread
From: Mikael Magnusson @ 2015-03-04 18:40 UTC (permalink / raw)
  To: zsh workers

The description of the parameter itself says

ZLE_LINE_ABORTED
       This  parameter  is  set  by the line editor when an error occurs.  It
       contains the line that was being edited at the  point  of  the  error.
       `print  -zr  --  $ZLE_LINE_ABORTED'  can  be used to recover the line.
       Only the most recent line of this kind is remembered.

and the description of send-break says

send-break (^G ESC-^G) (unbound) (unbound)
       Abort  the current editor function, e.g. execute-named-command, or the
       editor itself, e.g. if you are in vared. Otherwise abort  the  parsing
       of the current line; in this case the aborted line is available in the
       shell variable ZLE_LINE_ABORTED.

However, pressing ctrl-c inside vared stores whatever was being edited
in ZLE_LINE_ABORTED, which the above seems to imply should not happen.
The following adjusts the code accordingly. It was actually a bit
annoying if you set up a widget to do the up-line-or-aborted, because
it will grab the vared text as a command then.

diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index f344ecc..5b1d5f9 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1252,7 +1252,7 @@ zleread(char **lp,

     zlecore();

-    if (errflag)
+    if (errflag && zlecontext != ZLCON_VARED)
        setsparam("ZLE_LINE_ABORTED", zlegetline(NULL, NULL));

     if (done && !exit_pending && !errflag)



-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-06 16:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 18:40 PATCH: Don't store ZLE_LINE_ABORTED in vared context Mikael Magnusson
2015-03-05  1:57 ` Bart Schaefer
2015-03-05  2:41   ` Mikael Magnusson
2015-03-05  4:46     ` Bart Schaefer
2015-03-05  9:59 ` Peter Stephenson
2015-03-05 13:58   ` Peter Stephenson
2015-03-06  9:52     ` Peter Stephenson
2015-03-06 16:05       ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).