Ticket #224 (new defect)

Opened 3 years ago

Last modified 3 years ago

ANSI SGR escape codes reset on first command and after hiding Guake

Reported by: XanderX Owned by: somebody
Priority: minor Milestone:
Component: guake Version: 0.4.1
Keywords: ANSI, SGR, escape, control, codes Cc:

Description

I searched around and wasn't able to find this bug, so here goes.

I use the SGR portion of ANSI escape codes to style my prompt to make it easier to read by separating it from the commands I type. They're a bit weird, but I've managed to get my head around them. they're documented here:

 http://en.wikipedia.org/wiki/ANSI_escape_code

I use the following code to style the prompt (bash):

PS_BRIGHT_OPEN='\033[1m'
PS_CLOSE='\033[m'
PS1=$PS_BRIGHT_OPEN'\n\h:\w$ '$PS_CLOSE
PS2=$PS_BRIGHT_OPEN'   > '$PS_CLOSE

When this code runs I expect that the prompt is bold but the commands I type are not, like so:

'''linux-machine:/home/user$ '''ls -l

However, for the very first prompt that appears, there is no bold text to be seen. When I hit return, the new prompt that appears seems to be correct.

linux-machine:/home/user$ 

'''linux-machine:/home/user$ '''

If I then hide Guake and bring it back up, all the text reverts to just plain text! As if I had never applied the escape codes.

Further, if I neglect to reset the control codes, like so:

PS_BRIGHT_OPEN='\033[1m'
PS1=$PS_BRIGHT_OPEN'\n\h:\w$ '
PS2=$PS_BRIGHT_OPEN'   > '

The text appears correct, even after hiding Guake. Unfortunately though, this makes all the text in the shell bold, and that's not what I want.

Testing my codes in gnome-terminal, everything appears correct even if I minimise the window, switch tabs and so on. The problem seems to be something to do with how Guake displays the terminal.

Change History

Changed 3 years ago by XanderX

... Whoops, I forgot the code view would just display the wiki code.

Imagine that the sets of three apostrophes are opening and closing bold tags. ;)

Note: See TracTickets for help on using tickets.