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


Groups > gnu.bash.bug > #15474

Color forgotten after newline in prompt when resizing window

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From ao2@ao2.it
Newsgroups gnu.bash.bug
Subject Color forgotten after newline in prompt when resizing window
Date Sat, 05 Oct 2019 17:52:58 +0200
Lines 67
Approved bug-bash@gnu.org
Message-ID <mailman.1036.1570291338.2651.bug-bash@gnu.org> (permalink)
References <E1iGmMc-0005NW-UG@jcn>
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1570291338 22144 209.51.188.17 (5 Oct 2019 16:02:18 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ao2.it; s=20180927; h=Date:Message-Id:Subject:To:From; bh=3SThbgI3YExrBI40+jh10JQKUZQe/P8/5Gp8XPFz+3A=; b=fKPuqeRZ5K8xNM/ysYEz+P/0F1Yej3P4YGTpMj0i7rxKAhb5jQudImkT/Ze/JkpJx9SvNCoZET0xb9RNtP6k8tH7qLh+7GmED6/KPTL3Pk1wgKsnJqIpI6pMAlBhScauTY6jjx9iWOM9FXDzirqhqf0jJsGZvYCh3NGYGNqNbOfxlSvBlzuOVU3uAef6NQI2njsryjqmnAV94ydcjQNe9U5wldtMf8+Ekzo49TFWemorU5ECnnZV/kbQGAgfVK87ThGjmJrTLIGD4PUe2aJ/pGb+AakUEITsCVIR1iXKvh5mENqPlELCpcMVz7qGpnMbSWF5eigiu0M2gdurdhs12g==;
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 2001:4b98:dc0:41:216:3eff:fe7c:639b
X-Mailman-Approved-At Sat, 05 Oct 2019 12:02:06 -0400
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <E1iGmMc-0005NW-UG@jcn>
Xref csiph.com gnu.bash.bug:15474

Show key headers only | View raw


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


Thread

Color forgotten after newline in prompt when resizing window ao2@ao2.it - 2019-10-05 17:52 +0200

csiph-web