ANSI Prompt messes up list output.

Jan 17, 2021
20
0
Seeing other post on ANSI colours reminded me that I have a problem with them as well.

Using:
TCC 27.00.18 x64 Windows 10 [Version 10.0.19042.746]

And starting it from the installed link (Regular old Windows console).

If the prompt is set to:
prompt `$e[1;36m$p$g$e[0;m`

My old TCC/LE worked fine, but with version 27, the prompt itself works fine, but output of "list" is completely blank. It's there, just the colors are black on black or something.

1610908329802.png


Setting the prompt to "prompt $e[1;36m$p$g$e[0;37;40m" seems to "fix" it, but...why?

Thoughts?
 
May 20, 2008
11,411
99
Syracuse, NY, USA
I recall that, with the new-fangled Windows console, messing with the properties could corrupt things. Try this:

Code:
regdir /v /d hkcu\console | findstr ScreenColors

Does it show any zeros?
 
Jan 17, 2021
20
0
Nope.

Code:
d:\apps\tcc64>regdir /v /d hkcu\console | findstr ScreenColors
  ScreenColors : REG_DWORD : 7
    ScreenColors : REG_DWORD : 86
    ScreenColors : REG_DWORD : 86

I should point out that this doesn't happen in Microsoft Terminal. Only in the regular old console.
 
Jan 17, 2021
20
0
I think it might be worth pointing out that list seems to use whatever the prompt left the ANSI codes at. So setting the prompt to:
Code:
prompt $e[1;36m$p$g$e[0;37;40m

Make the prompt look like:
1610915031569.png


And list will use those colours:
1610915070850.png


Never using ANSI at all - in a prompt or anywhere else, results in "normal" behaviour.

Setting the prompt to "$e[0m$p$g" results in the black on black list behaviour.

My guess is that this would SEEM to be a "list" issue. Setting a SPECIFIC ANSI colour scheme works, but if it just gets reset to defaults with "$e[0m", list displays black on black. So, at least to the "list" command, never setting any ANSI codes (no ANSI prompt or startup colours) is somehow different than the settings after "$e[0m".
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
LIST is obsolete and deprecated, so if there are incompatibilities introduced by new Windows 10 builds, LIST will not be "fixed".

That said, two things:

1) LIST determines its colors by getting the attribute at the current cursor position, using the ReadConsoleOutputAttribute API. This will not work as you want when using ANSI, as the attribute that will be written by the Windows ANSI code is not the default console attribute.
2) You can define the colors you want LIST to use with the ListColor directive in TCMD.INI.
 
Nov 2, 2009
294
6
Chile
www.farah.cl
LIST is obsolete and deprecated, so if there are incompatibilities introduced by new Windows 10 builds, LIST will not be "fixed".

That said, two things:

1) LIST determines its colors by getting the attribute at the current cursor position, using the ReadConsoleOutputAttribute API. This will not work as you want when using ANSI, as the attribute that will be written by the Windows ANSI code is not the default console attribute.
2) You can define the colors you want LIST to use with the ListColor directive in TCMD.INI.

It seems to be "ListColors" (ListColor yielded an "invalid item name" error). I tested it with "White on Black" but the problem kept showing up; OTOH, "Green on Black", "cyan on red", "white on yellow", "bright white on black" (etc.), worked fine. Perhaps the problem manifests itself because white on black happens to be the default?

BTW, a similar problem affects the SELECT command (which I use all the time); although it's mitigated by my... gaudy... COLORDIR choices, it's annoying to see "empty" lines where the file name is only seen when the cursor bar is over it:

1610978864482.png


In this example, ".ico" files don't have a color, so "bandera.ico" can't be seen between "apple-touch-icon.png" and "calendario.html". The big black segment is due to the presence of ".inc" and ".php" files.
 
Nov 2, 2009
294
6
Chile
www.farah.cl
The SelectColors directive works, indeed, in the same fashion, down to getting the "black on black" text when the directive is set to "SelectColors=white on black". Making the last ANSI sequence in the prompt to be "$e[0;37;40m", as OP did, wades around the issue.
 
May 20, 2008
11,411
99
Syracuse, NY, USA
FreezerBurnt, do you have these set (OPTION\Windows tab)? I can reproducr the LIST problem when I set them all to (Default). MFarah, maybe they have something to do with SELECT also.

1611024803528.png
 
Nov 2, 2009
294
6
Chile
www.farah.cl
This is how I had 'em:

1611037039396.png


Changing the "Output:" colors to regular white on (default) [which was then magically converted to black] solved the issue.




(perhaps it's simply that "(default)" is read as the wrong "default" somewhere?)
 
Jan 17, 2021
20
0
Just trying to catch up here. My colours are literally the default:

1611097235961.png
 

Attachments

  • 1611097266047.png
    1611097266047.png
    5.4 KB · Views: 50
Jan 17, 2021
20
0
LIST is obsolete and deprecated, so if there are incompatibilities introduced by new Windows 10 builds, LIST will not be "fixed".

Why is list deprecated? It's one of the things I love about TCC, no external application to have a decent look at files (and in hex too).
 
Jan 17, 2021
20
0
Just looking into some colour settings, I have found that (using the $e[0m on my prompt - so I would normally get the black on black):

select will use:
SelectColors if they are set
StdColors, if SelectColors isn't set
Black on Black if neither are set

list will use:
StdColors if they are set
Black on Black if it's not set (ignores SelectColors)

Weird.
 
Supposedly VIEW replaces LIST, but I never use VIEW, and I use LIST a lot. If I wanted to open a new app to look at a file, I'd just use my text editor.
I am pro-list also, but after (begrudgingly) having used VIEW, I use it quite often now, mainly for the greenbar, and the fact that one can customize the keyboard shortcuts to emulate the LIST command.

It also has hex view.

I was so used to the DOS LIST.COM command, and the keyboard shortcuts that it uses, which is why I still use it.

I have managed to get the keyboard shortcuts for VIEW to emulate (the majority of) the DOS LIST.COM keyboard shortcuts.

Give VIEW an honest try for a while, and see how it works for you.

Joe
 
The reason I use LIST is that it displays in the existing window, so I don't have to move windows around if I am quickly looking at a file. "VIEW /w" tries to do this, but if the window loses focus, it becomes invisible; I want to be able to see it. I also like that LIST leaves what you were seeing in the window when you exit it so you can copy.
 
The reason I use LIST is that it displays in the existing window, so I don't have to move windows around if I am quickly looking at a file. "VIEW /w" tries to do this, but if the window loses focus, it becomes invisible; I want to be able to see it. I also like that LIST leaves what you were seeing in the window when you exit it so you can copy.
Fair enough.

What about the LIST.EXE that comes with the Windows 10 Kits;
Code:
e:\windows kits\10\debuggers\x64>dir list.exe

 Volume in drive E is New Volume   Serial number is 2c1e:6e61
 Directory of  E:\Windows Kits\10\Debuggers\x64\list.exe

2019-12-06  21:09          71,624  list.exe
              71,624 bytes in 1 file and 0 dirs    73,728 bytes allocated
1611154129453.png


Yes, it is an external program, yes you have to install the Windows SDK, but it does display in the existing window.

Joe
 
Hey @vefatica when LIST.EXE is active, press the F1 key.

I've never much used the TOOLS.INI file, as the defaults always worked for me, so not sure where the expected location is.

Note also LIST.EXE /? which returns;
Code:
e:\windows kits\10\debuggers\x64>list.exe /?
list [-s:string] [-g:line#] filename, ...

Something in the back of my mind says that the location of TOOLS.INI was determined by an environment variable that one set to point to the folder in which TOOLS.INI is located, but I don't remember the name of the environment variable, and I also may not be remembering this correctly.

Joe
 
May 20, 2008
11,411
99
Syracuse, NY, USA
There's WSL's less. But using it like this fails miserably. Too bad; less is pretty nice.

Code:
 type file | wsl less
 
May 20, 2008
11,411
99
Syracuse, NY, USA
Do any keys (up, down, q(uit)) work in less with PS7? None at all work with TCC/CMD/PS5 in TCMD or WT. The only way out is Ctrl-C.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica ANSI, PROMPT ... ??? Support 1
E Shorter prompt / ANSI codes support Support 10
vefatica ANSI??? Support 9
samintz ANSI issues Support 3
samintz ANSI Colors Support 33
nickles ANSI Colors Windows 7 no longer working Support 6
samintz WAD ANSI issue Support 3
AndrewJ TakeCommand v23 + ANSI color sequences leads to black on black text Support 6
K ANSI Not Working Support 8
vefatica ANSI, ANSIWin10 ... ? Support 2
vefatica Win10's ANSI doesn't like 2>NUL Support 10
vefatica How do I see Windows 10's ANSI in action? Support 3
M Please explain TCMD's ANSI x3.64 support Support 4
M ANSI is used to show files instead of OEM in version 17 to 19 ! Support 5
vefatica ANSI Support 11
vefatica WAD ANSI still misbehaves with build 35 Support 36
vefatica ANSI misbehavior????? Support 4
Peter Murschall UNICODE mixed with ANSI Code Support 11
J Piping ANSI control sequences through 'type' Support 4
gschizas Take Command (Environment) doesn't show v2 ANSI colors Support 30
B How to? Convert Unicode to ANSI Support 1
D Can ANSI escape sequences be used in keystroke aliases? Support 8
vefatica WAD ANSI <ESC>[K Support 5
M Ansi.sys and old Dos programs Support 7
R ansi.sys ?? Support 15
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
M How to? Black TCC Prompt Support 2
N Command execution slows down in TCC Prompt after a while Support 6
K Fixed Prompt display will be shifted after use dir to display a filename with Chinese. (v25.00.28 x64) Support 18
vefatica Timing commands with $= in the prompt? Support 16
samintz How to? Alias or prompt? Support 1
T Elapsed time format in prompt changed in TCC 25 Support 10
samintz MOVE and Prompt on overwrite Support 3
robinsiebler Creating a custom prompt Support 9
K TCC prompt background color Support 4
Alpengreis Problem if command prompt is not legacy Support 4
Joe Caverly Documentation Customizing the TCC Prompt Support 0
C How to? handle the UAC prompt on computer restarts with Everything Support 3
B when doing SFTP via IFTP to my secure site my users always get the finger print key prompt Support 1
M PROMPT with git branch Support 1
MikeBaas How to? SELECT: exclude files / display prompt Support 2
vefatica ? "prompt" command Support 3
S Elapsed time in TCC prompt question Support 0
Joe Caverly Determine if program started from command prompt Support 2
W Opening a new tab takes forever to get the command prompt Support 5
vefatica UAC prompt? Support 0
C How to? ctrl-c does not prompt "Terminate batch job" Support 2
Mordachai TCMD Prompt Here?!@ Support 14
vefatica Fixed DO, OSD, and cancel batch prompt Support 3
CWBillow Send Command-line with prompt? Support 6

Similar threads