Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Don't store ZLE_LINE_ABORTED in vared context
- X-seq: zsh-workers 34644
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: Don't store ZLE_LINE_ABORTED in vared context
- Date: Wed, 4 Mar 2015 19:40:03 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=D+ax8hga1VdJOJiSfDyP4JGq3OcZRMUorOGiHkIqveg=; b=OiTzO121Du+GiBmjJ2741C9fj4ck0sEIqFqJcXMHFWs+w6WEnlWtAlNDi7gC69EbHA KEu7frykuVGZO7ESdjr5wVNZrpfII6XPWToIjFf/KN2OzmT+E3k4mSkVn6HsXKbRdIyb YemY/vpSF5Iqm+b8rKnd3TP15SUZ5OEpVHfL3H67nfQcqy94L1cCGz5pKo1V4+WLaXtQ J5oT5a38B6Ud2vBqgVwvJl4PI3/hEmr5Gr7UsAutyQbgpD0gJeDzRuUKWOjF/Q45C5x3 wUN6/NH/7Lf5mw86/gXUcHp5wLw6GlHQukKJ+cMgjjZu4cLV7r6auJ4Ep0ioNqML6mGp OMpQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author