Machine: All archs
OS: All OSes
Bash Version: All versions since I have memory
Description:
When there's leftover output before the prompt (ie: when the
previous command output doesn't end in a new line), editing a
multi-line command from history doesn't correctly display what you
edit.
Repeat-By:
- Run a long command, one that wraps across more than one line
(can be anything).
- Run a command whose output doesn't end in a newline, eg:
echo -n "ASD".
- Press up twice to go back in history to the long command and
try to edit part of it.
- The text you are editing doesn't display properly, and it's
impossible to edit correctly.
I think bash assumes the line to edit begins at column 0 +
prompt_length, but in this case it begins after previous_output_length
+ prompt_lengt$
Fix:
Option A: If the previous command doesn't end in a newline,
add a newline manually. This is what most shells do.
Option B: Fix the line editor to take into account when the
prompt doesn't start at column 0.