Bash version: 5.3.20(1)-release
System: aarch64, Android 10 (Termux built-in terminal and xterm on the same 
device)

The cursor position is wrong after buffered arrow keys are consumed by readline 
when a foreground process exits.

Set the prompt first:
export PS1="\[\e[0;32m\]\w\[\e[0m\] \[\e[0;97m\]\$\[\e[0m\] "

Steps to reproduce:
1. Run `sleep 5`.
2. While it is running, press Down five times.
3. Wait for `sleep 5` to exit.
4. Press Up once.
5. Press Home.

Result: the cursor position is wrong at this point.
Expected: the cursor should be after the prompt, not inside the echoed `^[[B` 
sequence.

This reproduces in both the Termux built-in terminal and xterm on the same 
device, so it does not appear to be terminal-specific.

Reply via email to