Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15474
| From | ao2@ao2.it |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Color forgotten after newline in prompt when resizing window |
| Date | 2019-10-05 17:52 +0200 |
| Message-ID | <mailman.1036.1570291338.2651.bug-bash@gnu.org> (permalink) |
| References | <E1iGmMc-0005NW-UG@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"
the ANSI color sequences when the window is resized. I am not sure if
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 gnome-terminal or xterm, using
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
Color forgotten after newline in prompt when resizing window ao2@ao2.it - 2019-10-05 17:52 +0200
csiph-web