Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15475 > unrolled thread

Forgets color when resizing with newline in prompt

Started byao2 <ao2@jcn.localdomain>
First post2019-10-05 17:41 +0200
Last post2019-10-05 17:41 +0200
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Forgets color when resizing with newline in prompt ao2 <ao2@jcn.localdomain> - 2019-10-05 17:41 +0200

#15475 — Forgets color when resizing with newline in prompt

Fromao2 <ao2@jcn.localdomain>
Date2019-10-05 17:41 +0200
SubjectForgets color when resizing with newline in prompt
Message-ID<mailman.1039.1570292217.2651.bug-bash@gnu.org>
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?

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web