zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] add-zle-hook-widget zle-line-pre-redraw issue
Date: Sat, 23 Jul 2016 21:23:35 +0000	[thread overview]
Message-ID: <20160723212335.GA20872@tarsus.local2> (raw)

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.)


             reply	other threads:[~2016-07-23 21:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-23 21:23 Daniel Shahaf [this message]
2016-07-24  1:14 ` Bart Schaefer
2016-07-24 21:30   ` Daniel Shahaf
2016-07-28  2:34     ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160723212335.GA20872@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).