zsh-workers
 help / color / mirror / code / Atom feed
From: Christian Heinrich <christian@gladbachcity.de>
To: zsh-workers@zsh.org
Subject: Re: Segfault when displaying completion lists
Date: Tue, 09 Feb 2016 11:31:06 +0100	[thread overview]
Message-ID: <1455013866.1685.10.camel@gladbachcity.de> (raw)
In-Reply-To: <160208220038.ZM29149@torch.brasslantern.com>

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

Thanks guys, that was exactly the issue. I recompiled the code and it
works just as it should!

Christian

On Mon, 2016-02-08 at 22:00 -0800, Bart Schaefer wrote:
> On Feb 8,  6:39pm, Eric Cook wrote:
> }
> } This is a guess:
> 
> Pretty good one.
> 
> } If my guess is true, zsh should handle the menuselect keymap not
> } existing more elegantly.
> 
> This is a bit brute-force, but perhaps the following?  It has the
> added
> side-effect that if you create your own keymap named "menuselect"
> and/or
> "listscroll" before loading zsh/complist, your bindings take
> precedence.
> 
> diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
> index 06a07a4..937e1d1 100644
> --- a/Src/Zle/complist.c
> +++ b/Src/Zle/complist.c
> @@ -989,6 +989,7 @@ asklistscroll(int ml)
>  
>      fflush(shout);
>      zsetterm();
> +    menuselect_bindings();	/* sanity in case deleted by user
> */
>      selectlocalmap(lskeymap);
>      if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak))
>  	ret = 1;
> @@ -2433,6 +2434,7 @@ domenuselect(Hookdef dummy, Chdata dat)
>      unqueue_signals();
>      mhasstat = (mstatus && *mstatus);
>      fdat = dat;
> +    menuselect_bindings();	/* sanity in case deleted by user
> */
>      selectlocalmap(mskeymap);
>      noselect = 1;
>      while ((menuacc &&
> @@ -3486,6 +3488,37 @@ enables_(Module m, int **enables)
>  }
>  
>  /**/
> +static void
> +menuselect_bindings(void)
> +{
> +    if (!(mskeymap = openkeymap("menuselect"))) {
> +	mskeymap = newkeymap(NULL, "menuselect");
> +	linkkeymap(mskeymap, "menuselect", 1);
> +	bindkey(mskeymap, "\t", refthingy(t_completeword), NULL);
> +	bindkey(mskeymap, "\n", refthingy(t_acceptline), NULL);
> +	bindkey(mskeymap, "\r", refthingy(t_acceptline), NULL);
> +	bindkey(mskeymap, "\33[A",  refthingy(t_uplineorhistory),
> NULL);
> +	bindkey(mskeymap, "\33[B",  refthingy(t_downlineorhistory),
> NULL);
> +	bindkey(mskeymap, "\33[C",  refthingy(t_forwardchar), NULL);
> +	bindkey(mskeymap, "\33[D",  refthingy(t_backwardchar),
> NULL);
> +	bindkey(mskeymap, "\33OA",  refthingy(t_uplineorhistory),
> NULL);
> +	bindkey(mskeymap, "\33OB",  refthingy(t_downlineorhistory),
> NULL);
> +	bindkey(mskeymap, "\33OC",  refthingy(t_forwardchar), NULL);
> +	bindkey(mskeymap, "\33OD",  refthingy(t_backwardchar),
> NULL);
> +    }
> +    if (!(lskeymap = openkeymap("listscroll"))) {
> +	lskeymap = newkeymap(NULL, "listscroll");
> +	linkkeymap(lskeymap, "listscroll", 1);
> +	bindkey(lskeymap, "\t", refthingy(t_completeword), NULL);
> +	bindkey(lskeymap, " ", refthingy(t_completeword), NULL);
> +	bindkey(lskeymap, "\n", refthingy(t_acceptline), NULL);
> +	bindkey(lskeymap, "\r", refthingy(t_acceptline), NULL);
> +	bindkey(lskeymap, "\33[B",  refthingy(t_downlineorhistory),
> NULL);
> +	bindkey(lskeymap, "\33OB",  refthingy(t_downlineorhistory),
> NULL);
> +    }
> +}
> +
> +/**/
>  int
>  boot_(Module m)
>  {
> @@ -3503,27 +3536,7 @@ boot_(Module m)
>      }
>      addhookfunc("comp_list_matches", (Hookfn) complistmatches);
>      addhookfunc("menu_start", (Hookfn) domenuselect);
> -    mskeymap = newkeymap(NULL, "menuselect");
> -    linkkeymap(mskeymap, "menuselect", 1);
> -    bindkey(mskeymap, "\t", refthingy(t_completeword), NULL);
> -    bindkey(mskeymap, "\n", refthingy(t_acceptline), NULL);
> -    bindkey(mskeymap, "\r", refthingy(t_acceptline), NULL);
> -    bindkey(mskeymap, "\33[A",  refthingy(t_uplineorhistory), NULL);
> -    bindkey(mskeymap, "\33[B",  refthingy(t_downlineorhistory),
> NULL);
> -    bindkey(mskeymap, "\33[C",  refthingy(t_forwardchar), NULL);
> -    bindkey(mskeymap, "\33[D",  refthingy(t_backwardchar), NULL);
> -    bindkey(mskeymap, "\33OA",  refthingy(t_uplineorhistory), NULL);
> -    bindkey(mskeymap, "\33OB",  refthingy(t_downlineorhistory),
> NULL);
> -    bindkey(mskeymap, "\33OC",  refthingy(t_forwardchar), NULL);
> -    bindkey(mskeymap, "\33OD",  refthingy(t_backwardchar), NULL);
> -    lskeymap = newkeymap(NULL, "listscroll");
> -    linkkeymap(lskeymap, "listscroll", 1);
> -    bindkey(lskeymap, "\t", refthingy(t_completeword), NULL);
> -    bindkey(lskeymap, " ", refthingy(t_completeword), NULL);
> -    bindkey(lskeymap, "\n", refthingy(t_acceptline), NULL);
> -    bindkey(lskeymap, "\r", refthingy(t_acceptline), NULL);
> -    bindkey(lskeymap, "\33[B",  refthingy(t_downlineorhistory),
> NULL);
> -    bindkey(lskeymap, "\33OB",  refthingy(t_downlineorhistory),
> NULL);
> +    menuselect_bindings();
>      return 0;
>  }
>  

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

      reply	other threads:[~2016-02-09 10:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 22:58 Christian Heinrich
2016-02-08 23:39 ` Eric Cook
2016-02-09  6:00   ` Bart Schaefer
2016-02-09 10:31     ` Christian Heinrich [this message]

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=1455013866.1685.10.camel@gladbachcity.de \
    --to=christian@gladbachcity.de \
    --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).