[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Prompt messed up if PS1 contains ANSI escape sequences
From: |
Gioele Barabucci |
Subject: |
Re: Prompt messed up if PS1 contains ANSI escape sequences |
Date: |
Thu, 7 Sep 2023 15:46:23 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 |
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:
$ long_name="$(printf 'abcdef0123456789/%.0s' {0..20})"
$ mkdir -p /tmp/$long_name
$ cd /tmp/$long_name
$ PS1='\n\[\e[1m\]\w\[\e[m\] \$ '
(Adapted from <https://bugs.debian.org/631169>.)
Now press up to recall the last command and press down to go back to an
empty command line. Various stray characters will still be visible and
the cursor will be in the wrong place.
Also try to type any command (say `echo`) and you will notice that "cho"
ends up displayed in the wrong line.
Regards,
--
Gioele Barabucci
- Prompt messed up if PS1 contains ANSI escape sequences, Gioele Barabucci, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, alex xmb ratchev, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, alex xmb ratchev, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences,
Gioele Barabucci <=
- Re: Prompt messed up if PS1 contains ANSI escape sequences, Greg Wooledge, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, Gioele Barabucci, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, Greg Wooledge, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, Gioele Barabucci, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, Gioele Barabucci, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, Andreas Kähäri, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, alex xmb ratchev, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, alex xmb ratchev, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, Kerin Millar, 2023/09/07
- Re: Prompt messed up if PS1 contains ANSI escape sequences, alex xmb ratchev, 2023/09/07