From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id WAA05422 for ; Thu, 12 Sep 1996 22:05:20 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id HAA12389; Thu, 12 Sep 1996 07:40:44 -0400 (EDT) Resent-Date: Thu, 12 Sep 1996 07:40:44 -0400 (EDT) Message-Id: <199609121138.NAA07383@hydra.ifh.de> X-Authentication-Warning: hydra.ifh.de: Host pws@localhost didn't use HELO protocol To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: bindkey induced coredump In-reply-to: "Mark Hanson"'s message of "Thu, 15 Aug 1996 13:38:36 MET." <199608152038.NAA29423@acucobol.acucobol.com> Date: Thu, 12 Sep 1996 13:38:56 +0200 From: Peter Stephenson Resent-Message-ID: <"EXm9T2.0.V13.xQ_Do"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2131 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Mark Hanson wrote: > $ zsh -f > $ echo $ZSH_VERSION > 3.0.0 > $ bindkey -v > $ bindkey -r '\e[A' > $ bindkey -r '\e[B' > $ bindkey -r '\e[C' > $ bindkey -r '\e[D' > $ > coredump Doesn't look like anybody else has had a go at this. I think the following patch is right, but this had me confused for a long time. The confusion is all the different key binding tables. I think what's happening is this: the last bindkey -r deletes the entry for "\e" in keybindtab (which is vikeybindtab) since it now has nothing attached to it in mainbindtab. However it is still marked as a prefix in altbindtab, which is used in vi command mode, which is what the first enters. Hence the crash when zle tries to look for a key representing the prefix on the second . (keybindtab, as I understand it, is only used to resolve multi-key sequences and the like.) The answer seems to be to make sure the prefix entry is deleted in the other bindtab. It's not actually clear that one wants to remove all those cursor key entries in the alternate keymap, but given there is only one keybindtab for vi mode, that's currently inevitable. The remaining question is what to set the key to in the other bindtab, given that it was previously only set for a prefix. The choices are undefined or the same as in the first bindtab. I picked the latter. *** Src/zle_main.c.bind Thu Sep 5 22:47:12 1996 --- Src/zle_main.c Thu Sep 12 13:37:02 1996 *************** *** 991,997 **** --- 991,1005 ---- } (ky = (Key) keybindtab->getnode(keybindtab, s))->prefixct--; if (!ky->prefixct) { + int *otab = ops['a'] ? mainbindtab : altbindtab; tab[STOUC(*s)] = ky->func; + /* + * If the bindtab we are not using also + * adds this key as a prefix, it must also + * be reset. + */ + if (otab[STOUC(*s)] == z_prefix) + otab[STOUC(*s)] = ky->func; if (ky->func != z_sendstring) free(keybindtab->removenode(keybindtab, s)); } -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330 Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.