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. Right now I can only guess that maybe word splitting happens in two phases where in the first one natural word splitting is used and spaces are removed, and in the second phase the separator is respected but is still recorded as another word. This makes the default value of COMP_WORDBREAKS (in the context of bash if bash does the first phase) or rl_completer_word_break_characters (in the context of readline) misleading to the way words are split and retained because it includes the space as part of the value. Where the value was originally initialized doesn't matter. I also looked at other readline variables that may have influence on how a separator is kept like rl_special_prefixes but none of them seems to have anything to do with the space character. -- konsolebox