Re: completion-prefix-display-length doesn't check for common prefix

2016-06-02 Thread Grisha Levit
Looks like a bunch of stuff posted to the google group just came through.
This is a dupe.

On Wed, Apr 20, 2016 at 5:39 PM, Grisha Levit  wrote:

> f() { COMPREPLY=(aa bb cc); }
> complete -F f f
> bind 'set completion-prefix-display-length 2'
>
> $ f  [TAB][TAB]
> ...aa  ...bb  ...cc
>
> None of the completion entries share a common prefix, though the docs
> suggest that only common prefixes are removed:
>
> The length in characters of the common prefix of a list of possible
> completions
> that  is  displayed without modification.  When set to a value greater
> than zero,
> common prefixes longer than this value are replaced with an ellipsis
> when
> displaying possible completions.
>
>
> colored-completion-prefix has the same issue, in that it colors the first
> n characters, where n is the length of the word being completed.
>
> On a related note, colored-completion-prefix has no effect if
> completion-prefix-display-length is greater than 0.
>


completion-prefix-display-length doesn't check for common prefix

2016-06-02 Thread Grisha Levit
f() { COMPREPLY=(aa bb cc); }
complete -F f f
bind 'set completion-prefix-display-length 2'

$ f  [TAB][TAB]
...aa  ...bb  ...cc

None of the completion entries share a common prefix, though the docs suggest 
that only common prefixes are removed:

The length in characters of the common prefix of a list of possible 
completions
that  is  displayed without modification.  When set to a value greater than 
zero,
common prefixes longer than this value are replaced with an ellipsis when 
displaying possible completions.


colored-completion-prefix has the same issue, in that it colors the first n 
characters, where n is the length of the word being completed.

On a related note, colored-completion-prefix has no effect if 
completion-prefix-display-length is greater than 0.


Re: completion-prefix-display-length doesn't check for common prefix

2016-04-24 Thread Chet Ramey
On 4/24/16 3:36 PM, Grisha Levit wrote:
> On Fri, Apr 22, 2016 at 3:23 PM, Chet Ramey chet.ra...@case.edu
>  wrote:
> 
> Bash-4.4 doesn’t do this.
> 
> I was testing this with the latest devel version.
> 
> |$ echo$BASH_VERSION4.4.0(2)-rc1$ cat .inputrc set
> completion-prefix-display-length 2$ f() { COMPREPLY=(a b c); };
> complete -F f f $ f ddda b c $ f ...a
> ...b ...c |

I figured it out.  Readline uses what the user typed as the common prefix
if there are multiple matches that don't share a prefix at all.  It's been
like that for many years; I'm not going to change it before bash-4.4.  The
common prefix (and its length) is what is used to determine whether or not
the prefix display length code is active.

I'll look at changing this after bash-4.4 is released.  That's essentially
the cause of all the strange behavior, which is fairly rare.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: completion-prefix-display-length doesn't check for common prefix

2016-04-24 Thread Grisha Levit
On Fri, Apr 22, 2016 at 3:23 PM, Chet Ramey chet.ra...@case.edu
 wrote:

Bash-4.4 doesn’t do this.

I was testing this with the latest devel version.

$ echo $BASH_VERSION4.4.0(2)-rc1
$ cat .inputrcset completion-prefix-display-length 2

$ f() { COMPREPLY=(a b c); }; complete -F f f
$ f ddd
a  b  c
$ f 
...a  ...b  ...c

Note also this strange behavior, which is fixed if
completion-prefix-display-length is unset:

$ f d
abc

$ bind 'set completion-prefix-display-length 0'
$ f d
a  b  c

​


Re: completion-prefix-display-length doesn't check for common prefix

2016-04-22 Thread Chet Ramey
On 4/21/16 2:42 PM, Grisha Levit wrote:
> f() { COMPREPLY=(aa bb cc); }
> complete -F f f
> bind 'set completion-prefix-display-length 2'
> 
> $ f  [TAB][TAB]
> ...aa  ...bb  ...cc
> 
> None of the completion entries share a common prefix, though the docs
> suggest that only common prefixes are removed:

Bash-4.4 doesn't do this.

> On a related note, colored-completion-prefix has no effect if
> completion-prefix-display-length is greater than 0.

Yes, the current implementation prioritizes completion-prefix-display-length
over colored-completion-prefix

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



completion-prefix-display-length doesn't check for common prefix

2016-04-21 Thread Grisha Levit
f() { COMPREPLY=(aa bb cc); }
complete -F f f
bind 'set completion-prefix-display-length 2'

$ f  [TAB][TAB]
...aa  ...bb  ...cc

None of the completion entries share a common prefix, though the docs
suggest that only common prefixes are removed:

The length in characters of the common prefix of a list of
possible completions
that  is  displayed without modification.  When set to a value
greater than zero,
common prefixes longer than this value are replaced with an ellipsis when
displaying possible completions.


colored-completion-prefix has the same issue, in that it colors the
first n characters, where n is the length of the word being completed.

On a related note, colored-completion-prefix has no effect if
completion-prefix-display-length is greater than 0.