On Fri Nov 14 2014 at 2:47:04 PM Chet Ramey <chet.ra...@case.edu> wrote:
> On 11/14/14, 10:49 AM, Vadim Berezniker wrote: > > Thanks for the reply Chet, > > > > The completer is being setup in Bash, not directly through readline > (sorry > > if I wasn't detailed enough in my original post). > > Even though readline might break the completion on the ':', we can use > > COMP_LINE/COMP_POINT to figure out the URL that needs to be completed > > (ignoring the ':'). > > OK, I see. You can also use the arguments passed to the completion > function or the COMP_WORDS array to see readline's idea of the previous > word and use that as the prefix. > > Thanks. > > The problem of course is inserting the results. No matter what we return > > from the completer, readline is going to insert it after the ':' which > > means we have to strip off everything up to ':' in the completion > results. > > Yes. Something like "${results[@]/${prefix}/}" can be useful there, > assuming you put the possible completions into a `results' array and > build $prefix as described above. > Agreed. > > > If the completer had a way to tell readline (through Bash) where the > > completion should be inserted that would allow a workaround for this > issue > > without requiring any actions from the user. > > It's not only that, but the text that would have to be removed from the > buffer (the `previous' word) before inserting any possible completions, > and making sure that text isn't removed from the line inappropriately. > > Correct. Is that feasible? It looked doable from my look through the bash & readline code, but I don't have a lot of familiarity with intricacies of shells/terminals. Would there be interest in a patch that would implement such a feature? Thank you > Chet > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~ > chet/ >