Web lists-archives.com

Re: Bash-Problem with cursor position after calling a function with READLINE_LINE




Hi Stefan,

On 9/7/18 12:07 PM, Stefan Krusche wrote:
> Hallo Norbert,
> 
> Am Donnerstag, 6. September 2018 schrieb Norbert Gruener:
>> Hi all,
>>
>> In my Bash shell (».bashrc«) I have »bind« a command to the »F1« key
>>    bind -x '"\eOP":"_bash_man"'        # F1 man <command>
>>
>> The script »_bash_man«  looks like (it is simplified only for test reasons)
>>
>>    echo "${READLINE_LINE}"
> 
> I tried exactly that and it seems to work. I put only that one line in a script, 
> assigned the F1 key with bind to it and it outputs just the string I typed 
> before when I hit F1 like intended. No problems with cursor movements, 
> backspace and any other command line editing.
> 
> I'm on Devuan ascii and run GNU bash, Version 4.4.12(1)-release 
> (x86_64-pc-linux-gnu)

it is exactly the same version like in Debian Stretch.  My guess is that
this behavior is activated because of different default values. But it's
just my guess.

> 
>>    bash^[[D^[[C^[[B^[[A
> 
> This reminds me of programs (ed, rcs, telnet etc.) which don't use readline and 
> have less command line editing capabilities. Backspace should work, though.

It is exactly my impression too.  But I could not find any hint why the
»command line editing « should be deactivated in that case.

Cheers,
Norbert
--