Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15475
| From | ao2 <ao2@jcn.localdomain> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Forgets color when resizing with newline in prompt |
| Date | 2019-10-05 17:41 +0200 |
| Message-ID | <mailman.1039.1570292217.2651.bug-bash@gnu.org> (permalink) |
| References | <E1iGmBV-0005KB-62@jcn> |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security
uname output: Linux jcn 5.2.0-3-amd64 #1 SMP Debian 5.2.17-1 (2019-09-26) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 3
Release Status: release
Description:
I noticed that when there is a newline in the prompt bash "forgets"
about ANSI color sequences when the window is resized. I am not sure
f this is general for other kinds of ANSI escape codes.
Repeat-By:
1. Set the prompt to something like:
PS1='\[\033[36m\]cyan\ncyan\[\033[0m\]\$ '
or equivalently to:
PS1='\[$(tput setaf 6)\]cyan\ncyan\[$(tput sgr0)\]\$ '
2. Resize the terminal window and see the second line of the prompt
loosing the color.
I experience the problem with both gnome-terminal and xterm, so I don't think
it's the terminal emulator.
The issue can be worked around by specifying again the escape sequence after
the newline, e.g.:
PS1='\[\033[36m\]cyan\n\[\033[36m\]cyan\[\033[0m\]\$ '
But that should not be needed, right?
The problem does not occur in zsh with neither with gnome-terminal or xterm,
with the following equivalent prompt:
PROMPT=$'%{\e[36m%}cyan\ncyan%{\e[0m%}\$ '
or
PROMPT=$'%F{cyan}cyan\ncyan%f\$ '
so I thought it might be a bash specific issue.
Thank you,
Antonio
--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it
A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Forgets color when resizing with newline in prompt ao2 <ao2@jcn.localdomain> - 2019-10-05 17:41 +0200
csiph-web