[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Space vs. non-space separators in COMP_WORDBREAKS

From: Chet Ramey
Subject: Re: Space vs. non-space separators in COMP_WORDBREAKS
Date: Fri, 17 Dec 2021 11:49:25 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

On 12/16/21 6:56 PM, konsolebox wrote:
If I have a function like

     function _complete_something {
         printf -v __ '%q ' "$@"
         logger -p debug -t something "Args: $__"
         logger -p debug -t something "$(declare -p COMP_WORDS)"

And in COMP_WORDBREAKS I have '=' included in the assignment.

It's in the default value of rl_completer_word_breaks.

And I execute this command:

     complete -F _complete_something something

After I type something like this

     something --option=/something[TAB]

I'll also get = in one of the arguments.

This seems to mean that separators specified in COMP_WORDBREAKS that
aren't spaces are also passed as an
argument and stored in COMP_WORDS.  This surprised me a bit, and I
think it would be helpful if this behavior gets documented as well.

Well, the documentation says the line gets broken into words the way
readline does it, and readline uses the characters in
rl_completer_word_breaks as delimiters but doesn't remove them from
the list. It just uses them as word separators to bound the word to be

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]