Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Don't store ZLE_LINE_ABORTED in vared context
On Thu, 5 Mar 2015 09:59:44 +0000
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> Having the variable set in special cases is a bit of a headache, I
> agree, since you don't necessarily know they're there, even if there are
> ways round.
>
> It would be tempting to have a different variable for the vared case
> such as ZLE_VARED_ABORTED.
This would same to cover all the bases, except for the case where
someone really wants to use the same variable to deal with vared and the
shell command line. Mikael's experience suggests that's not the most
obvious or convenient case.
pws
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index dd8e628..b8b9b8c 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -2223,7 +2223,8 @@ item(tt(send-break) (^G ESC-^G) (unbound) (unbound))(
Abort the current editor function, e.g. tt(execute-named-command), or the
editor itself, e.g. if you are in tt(vared). Otherwise abort the parsing of
the current line; in this case the aborted line is available in the shell
-variable tt(ZLE_LINE_ABORTED).
+variable tt(ZLE_LINE_ABORTED). If the editor is aborted from within
+tt(vared), the variable tt(ZLE_VARED_ABORTED) is set.
)
tindex(run-help)
item(tt(run-help) (ESC-H ESC-h) (unbound) (unbound))(
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index a2f48e1..cec44c0 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1253,7 +1253,9 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
zlecore();
if (errflag)
- setsparam("ZLE_LINE_ABORTED", zlegetline(NULL, NULL));
+ setsparam((zlecontext == ZLCON_VARED) ?
+ "ZLE_VARED_ABORTED" :
+ "ZLE_LINE_ABORTED", zlegetline(NULL, NULL));
if (done && !exit_pending && !errflag)
zlecallhook(finish, NULL);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author