From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24821 invoked from network); 25 Aug 2008 18:22:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 25 Aug 2008 18:22:23 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 64393 invoked from network); 25 Aug 2008 18:22:14 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Aug 2008 18:22:14 -0000 Received: (qmail 7060 invoked by alias); 25 Aug 2008 18:22:07 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25533 Received: (qmail 7046 invoked from network); 25 Aug 2008 18:22:06 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 25 Aug 2008 18:22:06 -0000 Received: from mtaout01-winn.ispmail.ntl.com (mtaout01-winn.ispmail.ntl.com [81.103.221.47]) by bifrost.dotsrc.org (Postfix) with ESMTP id EA4468030846 for ; Mon, 25 Aug 2008 20:22:02 +0200 (CEST) Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20080825182202.FHBT777.mtaout01-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com> for ; Mon, 25 Aug 2008 19:22:02 +0100 Received: from pws-pc ([81.107.43.40]) by aamtaout03-winn.ispmail.ntl.com with ESMTP id <20080825182201.ODVY29597.aamtaout03-winn.ispmail.ntl.com@pws-pc> for ; Mon, 25 Aug 2008 19:22:01 +0100 Date: Mon, 25 Aug 2008 19:21:55 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: Quickhack that seems to fix issues with the menuselect keymap Message-ID: <20080825192155.5dcfcbaa@pws-pc> In-Reply-To: <200808250152.38836.raichoo@googlemail.com> References: <200808250152.38836.raichoo@googlemail.com> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV 0.92.1/8086/Mon Aug 25 14:20:55 2008 on bifrost X-Virus-Status: Clean On Mon, 25 Aug 2008 01:52:38 +0200 "xRaich[o]=C2=B2x" wrote: > I had some issues with Zsh (http://www.zsh.org/mla/users/2008/msg00772.ht= ml).=20 > I did a quickhack which seems to fix the behavior mentioned there, but i= =20 > don't know if this makes any sense at all. >=20 > i changed line 2315 of the complist.c file from > selectlocalmap(mskeymap); > into > selectkeymap("menuselect",1); >=20 > This is a "lets-see-what-happens" hack, so it might be complete rubbish.= =20 > Comments and pointers are very welcome since I'm totally new to Zsh I think I've worked out what this breaks (though there's a fuller patch to do the same thing attached, which I won't commit). From the documentation: Any key that is not bound in the listscroll keymap or that is bound to undefined-key is looked up in the keymap currently selected. So, for example, if you type "^F" without the patch it moves you forward through the list, while with the patch it doesn't because that's not bound in the main keymap. One reason why it's hard to do this without local key maps is that the main key map may be either vi or emacs mode, which have different bindings for this. So this may be a can of worms better left unopened. I'll leave this hanging until I get back again. I tickled at least two further oddities with menu completion looking at this. I think at least one is a bug, though it may still depend on the styles I have set: if the menu is too large for the screen, then hitting "return" accepts the completion (but not the line) but the line is hidden. (If it wasn't too long for the screen, it accepts the whole line, so this is a bit inconsistent anyway.) The other is that file-list is behaving unexpectedly with the argument "list=3D10". Neither problem is affected by this patch. Index: Src/Zle/complist.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v retrieving revision 1.118 diff -u -r1.118 complist.c --- Src/Zle/complist.c 6 Aug 2008 02:21:03 -0000 1.118 +++ Src/Zle/complist.c 25 Aug 2008 17:47:43 -0000 @@ -948,12 +948,13 @@ { Thingy cmd; int i, ret =3D 0; + char *okeymap =3D ztrdup(curkeymapname); =20 compprintfmt(NULL, 1, 1, 1, ml, NULL); =20 fflush(shout); zsetterm(); - selectlocalmap(lskeymap); + selectkeymap("listscroll", 1); if (!(cmd =3D getkeycmd()) || cmd =3D=3D Th(z_sendbreak)) ret =3D 1; else if (cmd =3D=3D Th(z_acceptline) || @@ -978,7 +979,8 @@ ungetkeycmd(); ret =3D 1; } - selectlocalmap(NULL); + selectkeymap(okeymap, 1); + zsfree(okeymap); settyinfo(&shttyinfo); putc('\r', shout); for (i =3D columns - 1; i-- > 0; ) @@ -2337,7 +2339,7 @@ int space, lbeg =3D 0, step =3D 1, wrap, pl =3D nlnct, broken =3D 0, f= irst =3D 1; int nolist =3D 0, mode =3D 0, modecs, modell, modelen, wasmeta; char *s; - char status[MAX_STATUS], *modeline =3D NULL; + char status[MAX_STATUS], *modeline =3D NULL, *okeymap; =20 msearchstack =3D NULL; msearchstr =3D ""; @@ -2407,7 +2409,8 @@ unqueue_signals(); mhasstat =3D (mstatus && *mstatus); fdat =3D dat; - selectlocalmap(mskeymap); + okeymap =3D ztrdup(curkeymapname); + selectkeymap("menuselect", 1); noselect =3D 1; while ((menuacc && !hasbrpsfx(*(minfo.cur), minfo.prebr, minfo.postbr)) || @@ -3282,7 +3285,8 @@ if (u->lastmatches !=3D lastmatches) freematches(u->lastmatches, 0); =20 - selectlocalmap(NULL); + selectkeymap(okeymap, 1); + zsfree(okeymap); mselect =3D mlastcols =3D mlastlines =3D -1; mstatus =3D NULL; inselect =3D mhasstat =3D 0; Index: Src/Zle/zle_keymap.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_keymap.c,v retrieving revision 1.29 diff -u -r1.29 zle_keymap.c --- Src/Zle/zle_keymap.c 3 Apr 2008 15:20:24 -0000 1.29 +++ Src/Zle/zle_keymap.c 25 Aug 2008 17:47:44 -0000 @@ -108,7 +108,7 @@ /* currently selected keymap, and its name */ =20 /**/ -Keymap curkeymap, localkeymap; +Keymap curkeymap; /**/ char *curkeymapname; =20 @@ -423,15 +423,6 @@ return 0; } =20 -/* Select a local key map. */ - -/**/ -mod_export void -selectlocalmap(Keymap m) -{ - localkeymap =3D m; -} - /* Reopen the currently selected keymap, in case it got deleted. This * * should be called after doing anything that might have run an * * arbitrary user-specified command. */ @@ -1310,15 +1301,9 @@ while(getkeybuf(!!lastlen) !=3D EOF) { char *s; Thingy f; - int loc =3D !!localkeymap; int ispfx =3D 0; =20 - if (loc) { - loc =3D ((f =3D keybind(localkeymap, keybuf, &s)) !=3D t_undefinedkey= ); - ispfx =3D keyisprefix(localkeymap, keybuf); - } - if (!loc) - f =3D keybind(km, keybuf, &s); + f =3D keybind(km, keybuf, &s); ispfx |=3D keyisprefix(km, keybuf); =20 if (f !=3D t_undefinedkey) { Index: Src/Zle/zle_main.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.114 diff -u -r1.114 zle_main.c --- Src/Zle/zle_main.c 31 Jul 2008 08:44:21 -0000 1.114 +++ Src/Zle/zle_main.c 25 Aug 2008 17:47:44 -0000 @@ -1025,7 +1025,6 @@ statusline =3D NULL; vilinerange =3D 0; reselectkeymap(); - selectlocalmap(NULL); bindk =3D getkeycmd(); if (bindk) { if (!zlell && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) && @@ -1163,7 +1162,6 @@ viinsbegin =3D 0; statusline =3D NULL; selectkeymap("main", 1); - selectlocalmap(NULL); fixsuffix(); if ((s =3D getlinknode(bufstack))) { setline(s, ZSL_TOEND); --=20 Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/