Re: Multi-line PS1 color disappearance problem

2023-12-21 Thread email--- via Bug reports for the GNU Bourne Again SHell

On 2023-12-21 17:55, Chet Ramey wrote:

Think of the portion of a multi-line prompt before the final newline as 
a

static string that will not affect the display of the last line.


Yep. Makes sense.

On 2023-12-21 17:32, Alex Ratchev wrote:


do u really PS1=\[\033 etc ?

try PS1='\[\e...'

in ' quotes


I forgot quotes from the email. But I did not know that '\e' is valid
ANSI escape sequence prefix. I just picked the one that looked most sane
to me from here (which does not contain '\e'):

https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797



Multi-line PS1 color disappearance problem

2023-12-21 Thread email--- via Bug reports for the GNU Bourne Again SHell

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt 
-fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat 
-Werror=format-security -fstack-clash-protection -fcf-protection 
-g -ffile-prefix-map=/build/bash/src=/usr/src/debug/bash -flto=auto 
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' 
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' 
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
uname output: Linux fuksilappari 6.6.7-arch1-1 #1 SMP PREEMPT_DYNAMIC 
Thu, 14 Dec 2023 03:45:42 + x86_64 GNU/Linux

Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.2
Patch Level: 21
Release Status: release

Description:
When PS1 contains line break and it sets color with ansi escape code 
before the line break,
then in any terminal emulator after zoom out or in, the color of the 
second line disappears.

The color is also missing terminal is opened.

Repeat-By:
PS1=\[\033[31m\]first line\nsecond line\[\033[0m\]
zoom in or out and observe disappearing color.

Compare to this which does not have the same problem due setting 
color again after the linebreak:

PS1=\[\033[31m\]first line\n\[\033[31m\]second line\[\033[0m\]