On Tue, Apr 9, 2024 at 12:14 PM Oliver Kiddle wrote: > Marlon Richert wrote: > > Shouldn't _complete do `PREFIX+=$SUFFIX; SUFFIX=` before calling > completion > > functions, since, otherwise, there is no meaningful difference between > it and > > _prefix? > > Definitely not. Given ac and candidate matches abc and acd, > _complete should complete to abc with complete_in_word set, offer both with > _prefix and complete to acd if complete_in_word is unset. > I did some testing and it actually works slightly differently. Given candidate matches abc, abcd and acd, * when given ac, * if complete_in_word is set, then * _complete completes to abc and * _prefix is never called. * if complete_in_word is unset, then * _complete completes to acd and * _prefix is never called. * when given ae, * if complete_in_word is set, then * _complete fails and * _prefix offers abc, abcd acd. * if complete_in_word is unset, then * _complete fails and * _prefix fails, too. In other words, given a command line , * if complete_in_word is set, then * _complete offers completions matching * _prefix offers completions matching * if complete_in_word is unset, then * _complete offers completions matching * _prefix also offers completions matching I suppose that's actually what it says on the tin, but it sure didn't come to me intuitively. I'm also still not sure whether all completion functions are using $PREFIX and $SUFFIX correctly, but I'll leave it at that.