bug-bash
[Top][All Lists]
Advanced

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

Multiline editing breaks if the previous output doesn't end in newline


From: Albert Vaca Cintora
Subject: Multiline editing breaks if the previous output doesn't end in newline
Date: Fri, 28 Oct 2022 14:21:20 +0200

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.



reply via email to

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