zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] zle: Call zle-line-pre-redraw after inserting a completion result
@ 2016-10-08 17:30 m0viefreak
  2016-10-11  3:03 ` Bart Schaefer
  2016-10-16 15:13 ` Daniel Shahaf
  0 siblings, 2 replies; 4+ messages in thread
From: m0viefreak @ 2016-10-08 17:30 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 897 bytes --]


This patch originated from a zsh-synatx-highlighting issue:
https://github.com/zsh-users/zsh-syntax-highlighting/issues/375

I think redrawhook() should be called at the end of do_single()
to make sure that zle-line-pre-redraw is run when cycling the results of
a menu completion.


By the way (unrelated):

The hooks (which served me as entry point for finding the right spot for
the path)

#define INSERTMATCHHOOK     (comphooks + 0)
#define MENUSTARTHOOK       (comphooks + 1)
#define COMPCTLMAKEHOOK     (comphooks + 2)
#define COMPCTLCLEANUPHOOK  (comphooks + 3)
#define COMPLISTMATCHESHOOK (comphooks + 4)
...
struct hookdef comphooks[] = {
    HOOKDEF("insert_match", NULL, HOOKF_ALL),
    HOOKDEF("menu_start", NULL, HOOKF_ALL),
    HOOKDEF("compctl_make", NULL, 0),
    HOOKDEF("compctl_cleanup", NULL, 0),
    HOOKDEF("comp_list_matches", ilistmatches, 0),
};

seem to be undocumented.

[-- Attachment #2: 0001-zle-Call-zle-line-pre-redraw-after-inserting-a-compl.patch --]
[-- Type: text/plain, Size: 723 bytes --]

From 6c1e1fe71011f8617a85fb2d53b7a36c8fcd0d07 Mon Sep 17 00:00:00 2001
From: m0viefreak <m0viefreak.cm@googlemail.com>
Date: Sat, 8 Oct 2016 18:53:55 +0200
Subject: [PATCH] zle: Call zle-line-pre-redraw after inserting a completion
 result

This is necessary to make sure redrawhook() is called while
cycling results in menu completion.
---
 Src/Zle/compresult.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 7fec7c8..b7ec18f 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1191,6 +1191,7 @@ do_single(Cmatch m)
 	if (menucmp)
 	    minfo.cur = &m;
 	runhookdef(INSERTMATCHHOOK, (void *) &dat);
+	redrawhook();
 	minfo.cur = om;
     }
 }
-- 
2.8.3


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

* Re: [PATCH] zle: Call zle-line-pre-redraw after inserting a completion result
  2016-10-08 17:30 [PATCH] zle: Call zle-line-pre-redraw after inserting a completion result m0viefreak
@ 2016-10-11  3:03 ` Bart Schaefer
  2016-10-16 15:13 ` Daniel Shahaf
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2016-10-11  3:03 UTC (permalink / raw)
  To: m0viefreak; +Cc: Zsh hackers list

On Sat, Oct 8, 2016 at 10:30 AM, m0viefreak
<m0viefreak.cm@googlemail.com> wrote>
>
> By the way (unrelated):
>
> The hooks (which served me as entry point for finding the right spot for
> the path)
>
> seem to be undocumented.

Those are module hooks as described in Etc/zsh-development-guide, not
hooks like the precmd etc. hooks for calling shell functions.  There
are only two modules that define hooks (zsh/zle and zsh/complete) and
neither of them documents their hooks anywhere outside the source code
AFAIK.

This has come up before -- the yodl doc is supposed to be for end
users, not developers of the shell, but there really isn't anyplace
where documentation of the C code is collected.


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

* Re: [PATCH] zle: Call zle-line-pre-redraw after inserting a completion result
  2016-10-08 17:30 [PATCH] zle: Call zle-line-pre-redraw after inserting a completion result m0viefreak
  2016-10-11  3:03 ` Bart Schaefer
@ 2016-10-16 15:13 ` Daniel Shahaf
  2016-10-17  8:39   ` Peter Stephenson
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-10-16 15:13 UTC (permalink / raw)
  To: zsh-workers; +Cc: m0viefreak

m0viefreak wrote on Sat, Oct 08, 2016 at 19:30:16 +0200:
> This patch originated from a zsh-synatx-highlighting issue:
> https://github.com/zsh-users/zsh-syntax-highlighting/issues/375
> 
> I think redrawhook() should be called at the end of do_single()
> to make sure that zle-line-pre-redraw is run when cycling the results of
> a menu completion.

Any thoughts on the patch?  With my z-sy-h hat, I confirm it behaves as
promised (applies highlighting whilst tabbing through menu completion),
but with my zsh hat, I am not familiar with zle enough to review this
patch.

Cheers,

Daniel

> From 6c1e1fe71011f8617a85fb2d53b7a36c8fcd0d07 Mon Sep 17 00:00:00 2001
> From: m0viefreak <m0viefreak.cm@googlemail.com>
> Date: Sat, 8 Oct 2016 18:53:55 +0200
> Subject: [PATCH] zle: Call zle-line-pre-redraw after inserting a completion
>  result
> 
> This is necessary to make sure redrawhook() is called while
> cycling results in menu completion.
> ---
>  Src/Zle/compresult.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
> index 7fec7c8..b7ec18f 100644
> --- a/Src/Zle/compresult.c
> +++ b/Src/Zle/compresult.c
> @@ -1191,6 +1191,7 @@ do_single(Cmatch m)
>  	if (menucmp)
>  	    minfo.cur = &m;
>  	runhookdef(INSERTMATCHHOOK, (void *) &dat);
> +	redrawhook();
>  	minfo.cur = om;
>      }
>  }


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

* Re: [PATCH] zle: Call zle-line-pre-redraw after inserting a completion result
  2016-10-16 15:13 ` Daniel Shahaf
@ 2016-10-17  8:39   ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2016-10-17  8:39 UTC (permalink / raw)
  To: zsh-workers

On Sun, 16 Oct 2016 15:13:54 +0000
Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> m0viefreak wrote on Sat, Oct 08, 2016 at 19:30:16 +0200:
> > This patch originated from a zsh-synatx-highlighting issue:
> > https://github.com/zsh-users/zsh-syntax-highlighting/issues/375
> > 
> > I think redrawhook() should be called at the end of do_single()
> > to make sure that zle-line-pre-redraw is run when cycling the results of
> > a menu completion.
> 
> Any thoughts on the patch?  With my z-sy-h hat, I confirm it behaves as
> promised (applies highlighting whilst tabbing through menu completion),
> but with my zsh hat, I am not familiar with zle enough to review this
> patch.

I can't see anything obviously wrong with it.

pws


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

end of thread, other threads:[~2016-10-17  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-08 17:30 [PATCH] zle: Call zle-line-pre-redraw after inserting a completion result m0viefreak
2016-10-11  3:03 ` Bart Schaefer
2016-10-16 15:13 ` Daniel Shahaf
2016-10-17  8:39   ` Peter Stephenson

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