From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26986 invoked by alias); 26 Apr 2011 00:56:20 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29049 Received: (qmail 1006 invoked from network); 26 Apr 2011 00:56:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110425175557.ZM1922@torch.brasslantern.com> Date: Mon, 25 Apr 2011 17:55:57 -0700 In-reply-to: Comments: In reply to "Jun T." "Re: menu-select interactive mode" (Apr 26, 2:06am) References: <110409131236.ZM16037@torch.brasslantern.com > <110410074855.ZM9428@torch.brasslantern.com> <110410115034.ZM9746@torch.brasslantern.com> <110424113837.ZM30279@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: menu-select interactive mode MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 26, 2:06am, Jun T. wrote: } } I have no idea why the else block is the appropriate place to } set origline etc, but anyway the following patch seems to solve } the *current* problem (but may break somewhere else...). The else block is appropriate because that's where metafy_line() is called ... if you look at docomplete() zle_tricky.c:629 you'll see where the metafy and setup of origline occur when menu selection is entered automatically rather than explicitly. I can't explain why the code paths are so different, other than for the usual historical reasons. } By the way, is it possible to continue the interactive mode after } accepting a match by hitting Return? No, hitting accept-line takes you entirely out of menu completion, so you're starting over with a new menu at that point. } I tried hitting ESC-m again } after the Return but it didn't work (either with or without the } following patch, although the behavior was different). } Hitting a key bound to accept-and-hold didn't work either. It should work to accept-and-hold if you do so *instead* of hitting return, but not after. } Index: Src/Zle/complist.c } =================================================================== } + if(minfo.cur) { } + origline = dupstrpfx(zlemetaline,minfo.pos); } + origcs = minfo.pos; } + origll = minfo.end; } + } I think this is almost right -- origll should probably be set to minfo.pos rather than minfo.end, and to be thorough there probably ought to be an "else" for the case where minfo.cur is NULL (but I suspect it's not possible for that to happen). Index: Src/Zle/complist.c =================================================================== --- complist.c 21 Dec 2010 16:41:16 -0000 +++ complist.c 26 Apr 2011 00:48:39 -0000 @@ -2390,8 +2390,19 @@ else { wasmeta = 0; metafy_line(); + if (minfo.cur) { + /* Restore state when menu completion began */ + origline = dupstrpfx(zlemetaline, minfo.pos); + origcs = minfo.pos; + origll = minfo.pos; + } else { + /* This branch may be unreachable */ + origline = dupstring(zlemetaline); + origcs = zlemetacs; + origll = zlemetall; + } } - + if ((s = getsparam("MENUSCROLL"))) { if (!(step = mathevali(s))) step = (lines - nlnct) >> 1;