Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 1/2] zle: Make sure state changes are refreshed after init hook



This patch causes a hang on startup with this .zshrc

zle -N zle-line-init foo
zle -N set-local-history bar
foo() { zle set-local-history -n 1 }
bar() { zle reset-prompt }

This patch fixes it, see also the commit a ways above,

     /*
      * On some windowing systems we may enter this function before the
      * terminal is fully opened and sized, resulting in an infinite
      * series of SIGWINCH when the handler prints the prompt before we
      * have done so here.  Therefore, hold any such signal until the
      * first full refresh has completed.  The important bit is that the
      * handler must not see zleactive = 1 until ZLE really is active.
      * See the end of adjustwinsize() in Src/utils.c
      */

@@ -1229,6 +1229,8 @@
     initmodifier(&zmod);
     prefixflag = 0;

+    zrefresh();
+
     unqueue_signals(); /* Should now be safe to acknowledge SIGWINCH */

     zlecallhook(init, NULL);


On 23 March 2013 15:46, Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
> If `zrefresh' is not called _after_ the zle-line-init hook, any changes
> made to the editor's state (be it changes to $CURSOR or $BUFFER or
> called widgets like `clear-screen') will only be picked up after the
> first character is typed into the editor.
> ---
>  Src/Zle/zle_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
> index e1a575b..5157ad3 100644
> --- a/Src/Zle/zle_main.c
> +++ b/Src/Zle/zle_main.c
> @@ -1219,12 +1219,12 @@ zleread(char **lp, char **rp, int flags, int context)
>      initmodifier(&zmod);
>      prefixflag = 0;
>
> -    zrefresh();
> -
>      unqueue_signals(); /* Should now be safe to acknowledge SIGWINCH */
>
>      zlecallhook("zle-line-init", NULL);
>
> +    zrefresh();
> +
>      zlecore();
>
>      if (errflag)
> --
> 1.8.2.rc1
>



-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author