Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread alex xmb ratchev
On Thu, Sep 7, 2023, 17:41 Kerin Millar wrote: > On Thu, 7 Sep 2023 17:33:45 +0200 > alex xmb ratchev wrote: > > > On Thu, Sep 7, 2023, 16:51 Kerin Millar wrote: > > > > > On Thu, 7 Sep 2023 15:53:03 +0200 > > > alex xmb ratchev wrote: > > > > > > > On Thu, Sep 7, 2023, 15:46 Gioele Barabucci

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Kerin Millar
On Thu, 7 Sep 2023 17:33:45 +0200 alex xmb ratchev wrote: > On Thu, Sep 7, 2023, 16:51 Kerin Millar wrote: > > > On Thu, 7 Sep 2023 15:53:03 +0200 > > alex xmb ratchev wrote: > > > > > On Thu, Sep 7, 2023, 15:46 Gioele Barabucci wrote: > > > > > > > On 07/09/23 15:00, alex xmb ratchev wrote:

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread alex xmb ratchev
On Thu, Sep 7, 2023, 16:51 Kerin Millar wrote: > On Thu, 7 Sep 2023 15:53:03 +0200 > alex xmb ratchev wrote: > > > On Thu, Sep 7, 2023, 15:46 Gioele Barabucci wrote: > > > > > On 07/09/23 15:00, alex xmb ratchev wrote: > > > > u have to \[ esc-seq \] > > > > eg inside \[ and \] > > > > > > > >

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Kerin Millar
On Thu, 7 Sep 2023 15:53:03 +0200 alex xmb ratchev wrote: > On Thu, Sep 7, 2023, 15:46 Gioele Barabucci wrote: > > > On 07/09/23 15:00, alex xmb ratchev wrote: > > > u have to \[ esc-seq \] > > > eg inside \[ and \] > > > > > > PS1=$'\u\[\e[1m\]\h\[\e[0m- ' > > > > > > should display hostname

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Gioele Barabucci
On 07/09/23 16:24, Gioele Barabucci wrote: On 07/09/23 16:15, Greg Wooledge wrote: On Thu, Sep 07, 2023 at 04:03:39PM +0200, Gioele Barabucci wrote: The following snippet shows that, even with the final \], Bash produces the same erroneous output and miscalculates the cursor position (it just

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread alex xmb ratchev
On Thu, Sep 7, 2023, 16:26 Andreas Kähäri wrote: > On Thu, Sep 07, 2023 at 04:03:39PM +0200, Gioele Barabucci wrote: > > On 07/09/23 15:50, Greg Wooledge wrote: > > > On Thu, Sep 07, 2023 at 03:46:23PM +0200, Gioele Barabucci wrote: > > > > On 07/09/23 15:00, alex xmb ratchev wrote: > > > > > u

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Andreas Kähäri
On Thu, Sep 07, 2023 at 04:03:39PM +0200, Gioele Barabucci wrote: > On 07/09/23 15:50, Greg Wooledge wrote: > > On Thu, Sep 07, 2023 at 03:46:23PM +0200, Gioele Barabucci wrote: > > > On 07/09/23 15:00, alex xmb ratchev wrote: > > > > u have to \[ esc-seq \] > > > > eg inside \[ and \] > > > > >

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Gioele Barabucci
On 07/09/23 16:15, Greg Wooledge wrote: On Thu, Sep 07, 2023 at 04:03:39PM +0200, Gioele Barabucci wrote: The following snippet shows that, even with the final \], Bash produces the same erroneous output and miscalculates the cursor position (it just needs a longer prompt): $

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Greg Wooledge
On Thu, Sep 07, 2023 at 04:03:39PM +0200, Gioele Barabucci wrote: > The following snippet shows that, even with the final \], Bash produces the > same erroneous output and miscalculates the cursor position (it just needs a > longer prompt): > > $ long_name="$(printf 'abcdef0123456789/%.0s'

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Gioele Barabucci
On 07/09/23 15:50, Greg Wooledge wrote: On Thu, Sep 07, 2023 at 03:46:23PM +0200, Gioele Barabucci wrote: On 07/09/23 15:00, alex xmb ratchev wrote: u have to \[ esc-seq \] eg inside \[ and \] PS1=$'\u\[\e[1m\]\h\[\e[0m- ' should display hostname bold Thanks for the suggestion, but adding

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread alex xmb ratchev
On Thu, Sep 7, 2023, 15:46 Gioele Barabucci wrote: > On 07/09/23 15:00, alex xmb ratchev wrote: > > u have to \[ esc-seq \] > > eg inside \[ and \] > > > > PS1=$'\u\[\e[1m\]\h\[\e[0m- ' > > > > should display hostname bold > > Thanks for the suggestion, but adding \] does not really fix the >

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Greg Wooledge
On Thu, Sep 07, 2023 at 03:46:23PM +0200, Gioele Barabucci wrote: > On 07/09/23 15:00, alex xmb ratchev wrote: > > u have to \[ esc-seq \] > > eg inside \[ and \] > > > > PS1=$'\u\[\e[1m\]\h\[\e[0m- ' > > > > should display hostname bold > > Thanks for the suggestion, but adding \] does not

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Gioele Barabucci
On 07/09/23 15:00, alex xmb ratchev wrote: u have to \[ esc-seq \] eg inside \[ and \] PS1=$'\u\[\e[1m\]\h\[\e[0m- ' should display hostname bold Thanks for the suggestion, but adding \] does not really fix the problem, it just masks it in many cases (better than nothing). Try: $

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread alex xmb ratchev
sorry \] missing bug PS1=$'\u\[\e[1m\]\h\[\e[0m\]- ' On Thu, Sep 7, 2023, 15:00 alex xmb ratchev wrote: > u have to \[ esc-seq \] > eg inside \[ and \] > > PS1=$'\u\[\e[1m\]\h\[\e[0m- ' > > should display hostname bold > > On Thu, Sep 7, 2023, 14:55 Gioele Barabucci wrote: > >> Bash 5.2.15

Re: Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread alex xmb ratchev
u have to \[ esc-seq \] eg inside \[ and \] PS1=$'\u\[\e[1m\]\h\[\e[0m- ' should display hostname bold On Thu, Sep 7, 2023, 14:55 Gioele Barabucci wrote: > Bash 5.2.15 (Debian 12) will produce erroneous output when PS1 contains > escape sequences. It will also misplace the cursor and corrupt

Prompt messed up if PS1 contains ANSI escape sequences

2023-09-07 Thread Gioele Barabucci
Bash 5.2.15 (Debian 12) will produce erroneous output when PS1 contains escape sequences. It will also misplace the cursor and corrupt the state of the current line. To replicate this issue: 1. Modify PS1 to contain one or more ANSI escape sequences, for example "\e[45m" (tput setab 5,