On Fri, Dec 17, 2021 at 7:13 PM Chet Ramey <chet.ra...@case.edu> wrote: > > On 12/17/21 2:00 PM, konsolebox wrote: > > On Sat, Dec 18, 2021, 00:49 Chet Ramey, <chet.ra...@case.edu> wrote: > >> 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 > >> completed. > > > > But that doesn't explain why the spaces are removed and I can't find > > anywhere in the documentation of readline that explains it. I would > > have to study the code itself to know why. > > Because nobody wants empty arguments to deal with, but it's useful to > know where readline splits the words when it finds the word it wants to > be completed. >
Ok but anyway, shouldn't this be mentioned in the manual? It's pretty much intuitive that if space is removed (which is the first one easily noticed), so should other separators specified in COMP_WORDBREAKS. In my opinion it would have been better if separators were stored in another variable than COMP_WORDS instead, where the index is the index in COMP_WORDS of the word that follows the separator or sequence of separators minus one. -- konsolebox