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


Groups > gnu.bash.bug > #15475

Forgets color when resizing with newline in prompt

Path csiph.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From ao2 <ao2@jcn.localdomain>
Newsgroups gnu.bash.bug
Subject Forgets color when resizing with newline in prompt
Date Sat, 05 Oct 2019 17:41:29 +0200
Lines 67
Approved bug-bash@gnu.org
Message-ID <mailman.1039.1570292217.2651.bug-bash@gnu.org> (permalink)
References <E1iGmBV-0005KB-62@jcn>
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1570292217 22859 209.51.188.17 (5 Oct 2019 16:16:57 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:From:Subject:To; bh=NkXlojkUl5O7i4lyhYZbP/g82SuIBfUujYbtpmvhgL4=; b=OsmlCtW2E3Tkb8OYfPLdwv1JRsyzyem6ZaUxKKmWfmd8zHJ1ObH8m/YiTSjQjMgiM9ZmkU+rW9654HY2MV/8f2eCVqL2MWl10ZMxin8q+C90RAgvjvI7Iupz0kWg9wiIHy9bQ27cgi7QCcHN1DddOGRUZssQUnkyQ3iiNUu7y4td/H2WjOqSnI1MMHlav2zOqfCqFEFw9WNuIMq5Ak+tDCsBCju+NINe+4VNj3/CvZL+cV7MR5kSoJRDDnlpe/HIQ21eeEgGnM2Yi8WMrsnN100fCN9JAPpnih6uXyFZD75NSMMLgqkPyw3a7ZgdvP1YS55mTRn0N2n3wCUASbFe9A==;
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:16:56 -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 <E1iGmBV-0005KB-62@jcn>
Xref csiph.com gnu.bash.bug:15475

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"
        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


Thread

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

csiph-web