Using ANSI codes in prompt causes the 'list' command to show a blank page...???

Mar 17, 2011
8
0
Hi,

I'm using TCC only, and a "ver" shows "TCC 26.02.43 x64 Windows 10 [Version 10.0.19042.1466]".

In my tcstart.btm I have the following (whittled down to the simplest, it's normally an execstr thingy):

set prompt=$P$e[32;1mFOO$e[0m$g
setdos /A1

Basically, show some text in green in latter part of the prompt, and then revert back. Works great in general, haven't seen a problem with it. However, when I try to "list somefile.txt", all I get is just the title line and the rest is a blank screen. There apparently is text there, so using the arrow keys shows the line number etc changing. If I do remove the end 'reset' escape sequence ($e[0m) the list command is now in green.

I've tried many ways to get list and prompt ansi escapes to work the way everything else seems to work fine, but I can't seem to get list to behave...any tips?

Thanks,

ken1
 
Aug 9, 2009
293
1
I've had this annoyance terminating ansi sequence is a MUST [30;40;0m
try color 8 0 before you list the file

I was wrong TC console behaves differently than WT where I run TC
 
Last edited:
May 20, 2008
11,840
120
Syracuse, NY, USA
The colors used for text in the LIST command, natch. ListStatBarColors controls the top line, and ListInverseColors is highlighted text, e.g. text matching a search.
Are those INI directives? I couldn't find any of them in the help. And I didn't see anything it the options dialog that would allow setting colors for LIST. While listcolors does not appear in my INI file, "OPTION listcolors" gives 0 (and LIST works just fine, even with prompt=$e[92m$p$g$s$e[0m).
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,577
97
Albuquerque, NM
prospero.unm.edu
Are those INI directives? I couldn't find any of them in the help. And I didn't see anything it the options dialog that would allow setting colors for LIST. While listcolors does not appear in my INI file, "OPTION listcolors" gives 0 (and LIST works just fine, even with prompt=$e[92m$p$g$s$e[0m).
It's been quite a few years since the help file covered .INI directives. But you still have your printed manuals, right?
 
Mar 17, 2011
8
0
What does option listcolors report?
Testing systematically with both lines commented out (otherwise completely empty tcstart.btm), either of them commented out, and none commented out.

In all cases, I get 'listcolors=0'.

Also reminds me, attaching my tcmd.ini...

Thanks for your help,

ken1
 

Attachments

  • TCMD.INI
    5.9 KB · Views: 22
Mar 17, 2011
8
0
I've had this annoyance terminating ansi sequence is a MUST [30;40;0m
try color 8 0 before you list the file

I was wrong TC console behaves differently than WT where I run TC
For completeness: neither of those suggestions helps.

Thanks for your help,

ken1
 
Mar 17, 2011
8
0
Are those INI directives? I couldn't find any of them in the help. And I didn't see anything it the options dialog that would allow setting colors for LIST. While listcolors does not appear in my INI file, "OPTION listcolors" gives 0 (and LIST works just fine, even with prompt=$e[92m$p$g$s$e[0m).
Another tidbit: the problem only occurs if I set the prompt in tcstart.btm. If I start with a tcstart.btm that just turns ansi on, and when tcc has started, I manually set the prompt as described, then list works.

Weird? Yes :-)

Thanks for you help,

ken1
 
May 20, 2008
11,840
120
Syracuse, NY, USA
Try this. It's my set-up and things are OK here. In TCMD.INI\[4NT] change "Ansi=No" to "Ansi=Yes" and remove the SETDOS statement from TCSTART.BTM. [You can also change the ANSI setting from the OPTION dialog ... check "ANSI colors" on the "Windows" tab.]
 
Mar 17, 2011
8
0
Try this. It's my set-up and things are OK here. In TCMD.INI\[4NT] change "Ansi=No" to "Ansi=Yes" and remove the SETDOS statement from TCSTART.BTM. [You can also change the ANSI setting from the OPTION dialog ... check "ANSI colors" on the "Windows" tab.]
FWIW, the setdos 'workaround' was originally part of an attempt to try to work around the problem. But yes, having it in the ini file makes more sense anyway, so I've returned to that, to no avail I'm afraid.

Also, this is what I actually had from the start, basically a simple perl skript that prints the branch I'm on in the prompt:

set prompt=$P$e[32;1m%%@execstr[@perl c:\ken1\git_branch.pl]$e[0m$g

Another attempt to handle it was to make the script itself print the ansi codes, so next attempt was this:

set prompt=$P%%@execstr[@perl c:\ken1\git_branch_withansi.pl]$g

Unfortunately, still no go.

For completeness, I also tried the sequence you described above:

set prompt=$e[92m$p$g$s$e[0m

Alas, nope :-/

Clearly (?) something in my env is different. Root cause would be nice to find, but as a workaround, setting 'listcolors' in the ini file does the trick nicely:

listcolors=bright white on blue

Or whatever color combo I will fancy tomorrow...:-)

ken1
 
May 20, 2008
11,840
120
Syracuse, NY, USA
I can now reproduce it. I reproduced it by checking the two "Use ..." boxes here. And now I can't get rif of it, even if I uncheck those boxes!

1643301524244.png


This must be due to some incompatibility between TCCv26 and the latest Windows console.

You can work around the promlen by specifying ListColors in TCMD.INI\[4NT]. The syntax for ListColors seems normal. Here, ListColors=Yel on Bla gives me exactly what I asked for. Whi on Bla seems to be the problem ... it gives Bla on Bla!

FYI, the current Windows console can handle 19 colors ... the usual 16-color palette plus a default foreground, a default background, and a cursor color. The last three are (supposed to be) what ^e[0m gives and need not be palette colors. You can change these three colors on the fly with the likes of this (the ones for the "Vintage" console color scheme).

Code:
echos ^e]10;rgb:C0/C0/C0^e\^e]11;rgb:00/00/00^e\^e]12;rgb:FF/FF/FF^e\

You can also change the 16-color palette. I use this string for the "Vintage" palette.

Code:
^e]4;0;rgb:00/00/00;1;rgb:80/00/00;2;rgb:00/80/00;3;rgb:80/80/00;4;rgb:00/00/80;5;rgb:80/00/80;6;rgb:00/80/80;7;rgb:C0/C0/C0;8;rgb:80/80/80;9;rgb:FF/00/00;10;rgb:00/FF/00;11;rgb:FF/FF/00;12;rgb:00/00/FF;13;rgb:FF/00/FF;14;rgb:00/FF/FF;15;rgb:FF/FF/FF^e\
 
May 20, 2008
11,840
120
Syracuse, NY, USA
Here's a rather kludgy workaround. You could do it in TCSTART.BTM. Pick a color that won't be used. I chose color 8 (bright black). I don't know if that's a good choice. Map it to the LIST foreground you desire (I used RBG = C0C0C0, normal white). And specify that color in OPTION //ListColors=.... Using color 0 (black) as the background, I did it like this.

Code:
echos ^e]4;8;rgb:C0/C0/C0^e\
option //ListColors=8 on 0

Note: In the above, "^e]" is known as OSC (operating system command) and OSC4 is the sequence initiator for a 16-color palette specification. The "^e\" is one version of ST (sequence terminator) which is required for OSC sequences. "8" is the palette index I used and C0/C0/C0 is the RR/GG/BB color spec.
 
Mar 17, 2011
8
0
Vince,

Thanks for your follow up on this; sorry for lateness...I've not been here for a while. Sorry to have screwed up your system a bit as well. Makes some sense now you mention it that it's tied to the console settings, rather than just the TCC settings only...

Basically, I've stopped trying to bend it; I'm happy with setting the 'listcolors'. Well, at least with something reproducable it gives a possibility of having this fixed in some future TCC release.

Thanks again,

ken1
 

Similar threads