bug-readline
[Top][All Lists]
Advanced

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

Re: [Bug-readline] Executing any bound shell command redraws the prompt


From: Šimon Let
Subject: Re: [Bug-readline] Executing any bound shell command redraws the prompt which seems unnecessary
Date: Sun, 6 Oct 2019 20:05:49 +0200


Thank you for your reply.

If I understand correctly, the issue is that the output of the command can modify the terminal contents. 
So theoretically, if there was a way to only allow the command to interact with the terminal contents by modifying $READLINE_LINE and/or $READLINE_POINT, Readline wouldn't have to redraw the prompt?

Would it be desirable to add a feature like this to Readline? 
Maybe an option for `bind -x` that makes Readline throw away any output produced by the command?


Regards,
Simon Let


On Thu, Oct 3, 2019 at 7:49 PM Chet Ramey <address@hidden> wrote:
On 10/2/19 4:47 PM, Šimon Let wrote:
> Version: GNU bash, version 5.0.9(1)-release (x86_64-pc-linux-gnu)
>
> Description (steps to reproduce):
> Create a dummy shell function: `funcX(){ local x=1; }`
> Bind shell command/function: `bind -x '"\C-x": funcX'`
> Hold down the "C-x" key.
> The prompt will flicker. 
>
> I suspect that the prompt is being redrawn with each execution of the shell
> command.

Bash and Readline don't know what this arbitrary command the produces
arbitrary output does to the contents of the terminal, or where it leaves
the cursor. It has to redraw at least the last line of the prompt, so it
knows the physical cursor location and can do redisplay.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/

reply via email to

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