help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Capture tab in a readline.


From: Sinbad
Subject: Re: [Help-bash] Capture tab in a readline.
Date: Tue, 22 Aug 2017 10:00:25 +0530

Hi Pierre,

Thanks for the reply. Yes i want to implement my own completion, for that i
need to detect tab, i tried '-d' option as
well, it doesn't work either. Actually i have been looking for a solution
for this for quite a while now. I'm surprised
there is no easy way to do this. If this doesn't work then i will have to
switch to either python or perl, but i'd like to
stick to bash if there is a way to do it.

Thanks


On Mon, Aug 21, 2017 at 6:14 PM, Pierre Gaston <address@hidden>
wrote:

>
>
> On Mon, Aug 21, 2017 at 2:41 PM, Sinbad <address@hidden> wrote:
>
>> Hi,
>>
>> I'm trying to capture tab with readline. The following is not working as
>> expected.
>> I don't want to use "-n 1", as i need the command editing capability. Any
>> advice ?
>>
>>
>> while IFS= read -e -i "$cmd" -p $prompt char
>> do
>>     if [[ "$char" == "$mytab" ]]; then
>>         echo "got tab"
>>     fi
>> done
>>
>
> It's not really clear what you intend to do exactly. But here is a couple
> of pointer:
>
> 1) If you don't use -n 1 then you will read a whole line. So you will need
> to type exactly one tab and press enter.
> 2) since you use -i "$cmd" you need to make sure you delete whatever is
> put by default
> 3) since you use -e, pressing tab will not insert a "TAB" character,
> instead it will try to complete, to be able to input a tab
> you will need to press "control-v" then a TAB
>
> Having said that, are you trying to implement completion?
>
>


reply via email to

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