[Top][All Lists]

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

Re: Tab completion and ':'s

From: Vadim Berezniker
Subject: Re: Tab completion and ':'s
Date: Fri, 14 Nov 2014 15:49:59 +0000

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 ':').
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.
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.
(This is probably not the most ideal solution, but I can't think of any
other that wouldn't require major changes.)

On Fri Nov 14 2014 at 9:37:32 AM Chet Ramey <chet.ramey@case.edu> wrote:

> > I'm working on adding tab completion to an application that deals with
> > URLs, among other things. Since readline includes ':' as a delimiting
> > character, it causes minor annoyances with tab-completing URLs. There's
> the
> > known workaround of removing ':' from COMP_WORDBREAKS, but that requires
> > every person that installs the application to apply the workaround, which
> > is slightly less than ideal.
> If you're integrating readline directly into an application, you can set
> the completion word break characters to whatever you like; see
> rl_completer_word_break_characters.
> > I'm trying to see if there's a better solution that doesn't require any
> > action from the user. One thought I had was what if readline/bash allowed
> > control over the insertion point of the completion result? i.e. if there
> > was a COMP_INSERT_POINT variable that could get/set the insertion point.
> Is
> > that feasible?
> I'm not sure how you would use this, since readline breaks the line into
> words
> for the completion code before the results are generated and inserted.
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~
> chet/

reply via email to

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