[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ./script doesn't work in completion function
From: |
Chet Ramey |
Subject: |
Re: ./script doesn't work in completion function |
Date: |
Mon, 22 Jan 2024 10:08:28 -0500 |
User-agent: |
Mozilla Thunderbird |
On 1/20/24 12:20 PM, Oğuz wrote:
See:
$ echo echo foo bar >s
$ chmod +x s
$ f(){ COMPREPLY=($(bash ./s));}
$ complete -F f g
$
$ g
bar foo
$ g ^C
$
$ f(){ COMPREPLY=($(./s));}
$ g ^C^C
$
I press tab after typing `g ' in both cases, this moves the cursor to
the right in the second case instead of showing the completion
options.
Thanks for the report. The script works, it just leaves the terminal in
icanon mode, so the tabs don't cause word completion until you hit newline.
The problem is the subshell inherits the readline state, so it can tell
whether or not the terminal is in icanon mode should it need to, but resets
it to icanon mode at exit without making sure it was the one that set it to
-icanon in the first place.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: ./script doesn't work in completion function,
Chet Ramey <=