zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] add-zle-hook-widget zle-line-pre-redraw issue
@ 2016-07-23 21:23 Daniel Shahaf
  2016-07-24  1:14 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-07-23 21:23 UTC (permalink / raw)
  To: zsh-workers

Hooks registered with «add-zle-hook-widget zle-line-pre-redraw $hook»
aren't invoked.  In contrast, hooks registered with zle-line-finish are
invoked.

The reason appears to be that, while in azhw:zle-line-init $WIDGET is
"zle-line-init", in azhw:zle-line-pre-redraw $WIDGET is the name of the
widget the user invoked (e.g., "self-insert"), so the 'zstyle -a' does
not find the registered hooks.

Each of the following alternative patches solves the issue:

First option:
[[[
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index ac31d4e..9f2742a 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1054,7 +1055,7 @@ void redrawhook(void)
 	args[0] = initthingy->nam;
 	args[1] = NULL;
 	incompfunc = 0;
-	execzlefunc(initthingy, args, 0);
+	execzlefunc(initthingy, args, 1);
 	incompfunc = old_incompfunc;
 	unrefthingy(initthingy);
 	unrefthingy(lbindk);
]]]

Second option:
[[[
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index ac31d4e..90e54d6 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1044,6 +1044,10 @@ getrestchar(int inchar, char *outstr, int *outcount)
 void redrawhook(void)
 {
     Thingy initthingy;
+
+    zlecallhook("zle-line-pre-redraw", NULL);
+    return;
+
     if ((initthingy = rthingy_nocreate("zle-line-pre-redraw"))) {
 	int lastcmd_prev = lastcmd;
 	int old_incompfunc = incompfunc;
]]]

The principal differences seem to be which set of globals is
saved/restored or changed/restored; however, which set it should be is
all Greek to me.

Cheers,

Daniel
(I haven't tested the other hook types.)


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

end of thread, other threads:[~2016-07-28 14:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-23 21:23 [PATCH] add-zle-hook-widget zle-line-pre-redraw issue Daniel Shahaf
2016-07-24  1:14 ` Bart Schaefer
2016-07-24 21:30   ` Daniel Shahaf
2016-07-28  2:34     ` 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).