Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [bug report] prompt can erase messages written on the terminal by background processes



On Wed, Dec 7, 2022 at 8:04 PM Millian Poquet <millian.poquet@xxxxxxx> wrote:
>
> prompt can erase messages written on the terminal by background processes

Not just prompt but zle in general, or any program really that moves
the cursor (try `top`, for example, or `less`). There is no way around
it. Zle assumes that nobody else prints to the terminal. If this
assumption is violated, the outcome is unspecified mess.

Here's a simpler demonstration. Run this in interactive zsh:

  ( sleep 3; print -rn hello ) &!

Then immediately type "ls" and wait without hitting enter. A moment
later "hello" will appear on the command line. Try editing it and
observe that zle is essentially broken.

You can break any terminal program that moves the cursor by using this
trick. Try running `top` immediately after the command listed above,
or after you C program, which is essentially the same.

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author