From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17098 invoked by alias); 27 Feb 2013 17:33:42 -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: 31073 Received: (qmail 19273 invoked from network); 27 Feb 2013 17:33:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.co.uk does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1361986052; bh=f8WoEil8CflvXKqABPqI2AE2oe8Nmt2H6LloQu4T638=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:cc:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=XgkbKQLWjwd41n1B5tkEAEHsfhdIF5/lCE7NAcfckzaMZtE3Rl8zJ9YBlf9PsdEXT0usSnVWGyD3Tlv7ArzuO56CyZTooFLZgot17eTEDaDYYzDgAwOF2o6X9uMnwWt9RFuZwf5DhB+hIGb+5jGNTddkOKvlST4yrSX9lJeFVQU= X-Yahoo-Newman-Id: 344522.65994.bm@smtp112.mail.ird.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: HddiXngVM1mY1ZVc._xuLyvYFh5.UKZCEaBjRHsrjwsmT6W ZOLg_yQhtoo.H2BgTnkCCLoLvVDBiVGIanqdB8zg89xISxZw6cuy5UfuaC3l XYJE38AIe72AYeVKx8r4s.bwHcUy7odwaJtK7am4ndY0wZSFaApUUGQSSPg9 3lHE2uLa1O0kj6acq_wzGdLT5GxHAb_zd.hvh9n9G9N2McqW_TU4codsoafJ DkvIdFW02USeeZD9OSKi5jxdJTyKHfLXhnDFTeSecZBbhcN40ECU85w65wDt NyAxOvYjJW9YSNuUZ_.7ITy1msMc_r6vi9xFlbPWWxxSpq76P1vV8gaV0LPT AeurkZyxemDSfWcS999BUc5Y0WHm0zBA_405Q0pfRdMqoUEBySIZn3qqiMpP EJ.6KA9Auq9MPGTBbcna3sTM_8sBIbT13w9SJ2KYLfMwKeQ-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: zsh-workers@zsh.org In-reply-to: From: Oliver Kiddle References: To: Olivier Teuliere Subject: Re: Limitations of menuselect MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21076.1361986041.1@thecus.kiddle.eu> Date: Wed, 27 Feb 2013 18:27:31 +0100 Message-ID: <21084.1361986051@thecus.kiddle.eu> Olivier Teuliere wrote: > 1) Custom bindings don't work. You can try it with the following: > my-widget() { zle down-line-or-history }; zle -N my-widget; > bindkey -M menuselect k my-widget > (replacing "my-widget" with "down-line-or-history" in the bindkey > command works as expected). Yes, unfortunately it isn't possible. > Someone told me on IRC that in menuselect a hard-coded table is used > to lookup the widget names. More or less. It seems any keybinding picked up from the main keymap will work though menu selection is exited first. For anything from the menuselect keymap, it hard codes the actions with various widgets being overloaded from their original meanings. I'm not sure that I get the point of this. If it meant that your existing key-bindings would do something appropriate it might make sense but you do have to duplicate them in the menuselect keymap. Was this perhaps a bug introduced later such as when local keymaps were added? In any case, I'd have thought it was simpler if there were separate widgets - e.g. menu-up-entry instead of up-line-or-history being overloaded. > 2) Moving the selected menu item line by line is nice, but scrolling > several lines at a time would be nicer (that's what I would expect > PageUp and PageDown to do by default in menuselect, for example). I > couldn't find an existing widget for that. You can do some hacks with bindkey -s. For example: bindkey -M menuselect j down-line-or-history bindkey -M menuselect -s n 'jj' What you can do with that is limited. Also, it doesn't cope well with putting escapes in the latter string. > 3) When using the reverse-menu-complete widget to open menuselect, I > would like to select the last result, not the first one (otherwise I > can use menu-complete directly...). It doesn't sem to be possible at > the moment. That seems like a bug to me. > 4) When moving the selection in the menu, the inserted text changes. > But for some reason, the accept-line widget only closes the menu, > without accepting the line. So to really accept the line I have to > call accept-line again (basically, I have to hit Enter twice). This > behavior seems a bit backwards: if I wanted to accept the current > selection, which is already inserted, I could simply go on typing, I > don't need an extra validation step. So, would it be possible to have > accept-line really accept the line? :) If the current behavior is > still wanted, it could maybe be called "accept-selection", because the > current name is misleading... This probably wouldn't be hard to implement if we keep to the scheme of overloading existing widgets. You can abuse the behaviour I described earlier to make Enter really accept the line: bindkey -M menuselect -r '^M' zle -N new-accept-line new-accept-line() { zle .accept-line } bindkey '^M' new-accept-line But don't do this because it'll break the enter key in other contexts (reading from the mini-buffer). To replace accept-line without breaking things you need to use zle -A but that won't work here. > 5) Apparently, menuselect always inserts the selected text. But if > there was a way (maybe using a style) to select a menu entry without > inserting the corresponding text, it could allow a killer feature: > typing characters could shrink the list of results (for example, by > binding individual letter keys to an appropriate widget... Actually, this is possible. Bind a key to vi-insert in menuselect and you get "interactive" mode which does this. Still, there is a lot of ways this could be better. Unfortunately, you stay in the menuselect keymap at this point which is irritating if you've, for example, bound / to history-incremental-search-forward. I can't think of a way to go straight into this mode. The bindkey -s trick stuck it in an infinite loop. > accept-line-and-infer-history maybe?), while still allowing to select That also does something similar already: bindkey -M menuselect '^M' accept-and-infer-next-history then enter will keep in menu selection. > I hope that these remarks make sense and that I haven't overlooked > some existing features... It certainly makes sense and is quite thought provoking. I'm only sorry that my answers aren't especially helpful. Oliver