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 <[email protected]> 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    [email protected]    http://tiswww.cwru.edu/~chet/
>
_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to