Re: Ignore-case option to readline disables nosort option to complete
On Wed, May 3, 2017 at 4:30 PM, Eduardo Bustamantewrote: > > I think this was fixed as a consequence of the following thread: > https://lists.gnu.org/archive/html/bug-bash/2017-03/msg00092.html > > In this commit: > http://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel= > f698849a75fc781472806182c3dc930077a5d828 > Oh, I see. Sorry for the noise, then. Great to see that it's fixed already.
Ignore-case option to readline disables nosort option to complete
The following snippet is shows that if the readline option completion-ignore-case is turned on, the nosort option to complete has no effect: bind "set completion-ignore-case on" _foo() { COMPREPLY=( zoo noo boo ) return 0 } complete -o nosort -F _foo foo With the ignore-case option turned on, completion on foo gives "boo noo zoo", i.e. in alphabetical order. If the ignore-case is not turned on, completion on foo gives the intended order "zoo noo boo". It seems to me that this is not ideal: it would be nice to have both case-insensitive completion AND the possibility to keep the intended order for alternatives.
Inhibit redisplay of prompt in 4.4-alpha
I am testing the following change in 4.4-alpha: ggg. The commands executed by `bind -x' now redisplay at most the final line of a multi-line prompt, and those commands may return 124 to indicate that the entire prompt should be redrawn. This is great news and means that two-line prompts now can be used with bind -x. It seems to work as intended. I see that a function can return 124 to make the whole prompt redisplay. However, for my purposes, it would be even better if there also was a code that a function could return which would inhibit all redisplay of the prompt. I have described the kind of widget functions that I use in the thread bind -x and multiple prompt/command lines from April of 2014. When using such a function, the flickering that results from the prompt redisplaying is a bit annoying. If there were some return code that could inhibit the prompt redisplay, that would therefore be great.
Re: bind -x and multiple prompt/command lines
Chet, Not that it is pressing in any way, but have you had any time to look at this? On Tue, Apr 22, 2014 at 1:34 PM, Jesper Nygårds jesper.nyga...@gmail.comwrote: Here are simplified versions of two functions that I have written. Both are inspired by similar functions floating around on the zsh mailing lists. The first copies the previous word on the command line, and the second one converts three consecutive dots (...) into ../.., and you can then keep adding levels by typing . repeatedly. Note that I am by no means an expert in Bash programming, so I'm sure the same thing could be done more elegantly. bind -x '.:_rationalise-dot' bind -x '\e::_copy-previous-word' _copy-previous-word () { local -a words eval words=($READLINE_LINE) #NOTE: copies quoted words correctly, but does not insert with the escape intact READLINE_LINE+=${words[${#words[@]}-1]} READLINE_POINT=${#READLINE_LINE} } _rationalise-dot () { if [[ ${READLINE_LINE:0:$READLINE_POINT} == *\.\. ]]; then READLINE_LINE=${READLINE_LINE:0:$READLINE_POINT}/..${READLINE_LINE:$READLINE_POINT} ((READLINE_POINT+=3)) else READLINE_LINE=${READLINE_LINE:0:$READLINE_POINT}.${READLINE_LINE:$READLINE_POINT} ((READLINE_POINT++)) fi } On Fri, Apr 18, 2014 at 3:13 PM, Chet Ramey chet.ra...@case.edu wrote: On 4/15/14, 11:22 AM, Jesper Nygårds wrote: I don't have any solution to offer, but I would like to second the wish for this to work better, and for the same reason: I have written several very useful functions for rewriting the command line, binding them with bind -x. Like Rob, I have concluded that it does not work well with a multi-line prompt, as the visual effect of the prompt moving further and further down is rather unpleasant. Can you send me one or two so I can play around with them and see what the options are? Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.edu http://cnswww.cns.cwru.edu/~chet/
Re: bind -x and multiple prompt/command lines
Here are simplified versions of two functions that I have written. Both are inspired by similar functions floating around on the zsh mailing lists. The first copies the previous word on the command line, and the second one converts three consecutive dots (...) into ../.., and you can then keep adding levels by typing . repeatedly. Note that I am by no means an expert in Bash programming, so I'm sure the same thing could be done more elegantly. bind -x '.:_rationalise-dot' bind -x '\e::_copy-previous-word' _copy-previous-word () { local -a words eval words=($READLINE_LINE) #NOTE: copies quoted words correctly, but does not insert with the escape intact READLINE_LINE+=${words[${#words[@]}-1]} READLINE_POINT=${#READLINE_LINE} } _rationalise-dot () { if [[ ${READLINE_LINE:0:$READLINE_POINT} == *\.\. ]]; then READLINE_LINE=${READLINE_LINE:0:$READLINE_POINT}/..${READLINE_LINE:$READLINE_POINT} ((READLINE_POINT+=3)) else READLINE_LINE=${READLINE_LINE:0:$READLINE_POINT}.${READLINE_LINE:$READLINE_POINT} ((READLINE_POINT++)) fi } On Fri, Apr 18, 2014 at 3:13 PM, Chet Ramey chet.ra...@case.edu wrote: On 4/15/14, 11:22 AM, Jesper Nygårds wrote: I don't have any solution to offer, but I would like to second the wish for this to work better, and for the same reason: I have written several very useful functions for rewriting the command line, binding them with bind -x. Like Rob, I have concluded that it does not work well with a multi-line prompt, as the visual effect of the prompt moving further and further down is rather unpleasant. Can you send me one or two so I can play around with them and see what the options are? Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.edu http://cnswww.cns.cwru.edu/~chet/
Re: bind -x and multiple prompt/command lines
I don't have any solution to offer, but I would like to second the wish for this to work better, and for the same reason: I have written several very useful functions for rewriting the command line, binding them with bind -x. Like Rob, I have concluded that it does not work well with a multi-line prompt, as the visual effect of the prompt moving further and further down is rather unpleasant. I have for now accepted that I have to live with a one-line prompt, if I have to choose between my functions and a two-line prompt. Furthermore, I found this thread from 2009: https://lists.gnu.org/archive/html/bug-bash/2009-07/msg00075.html where Chet talks about the possibility of a function requesting that the prompt not be redrawn at all, and I would love to see this implemented. There are many great things one can do with the bind -x command, but some of them are a little less attractive when they cause a redrawing of the prompt. Jesper