Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WAD Can we fix the ANSI rendering bugs yet? They don't happen in other shells.

Jul
532
10
I've seen a lot of other complaints about this, but yea.

It's not a WT issue.
It's a TCC issue.

It doesn't happen in WT under CMD.EXE with the exact same commands.
It doesn't happen in WT under PowerShell with the exact same commands

It DOES happen in WT under TCC with the exact same commands
It DOES happens in TCC without WT.
...and only for screen rendering, not when sending to a file.


The working example i used today to prove this to myself was a simple:
Code:
unset /q grep_color
unset /q grep_colors
type c:\dropbox\personal.htm | c:\cygwin\bin\grep.exe --color=always HOME.THEATRE

Simply hit up-arrow and enter and you can see ansi leak out 1 out of 8 or so tries.

I set up a script to do this 1000 times to temporary files. They all had the same CRC32. This only happens in screen rendering, not piping.


I'm not going to share my personal.htm file from my dropbox ;), but here are the matching lines, in case that's somehow important (I do not believe it is):

Code:
other lines
other lines
other lines
other lines
other lines
HOME THEATRE INPUT SETUP:
HOME THEATRE INPUT SETUP: Main TV ———> HDMI#2       — Main computer, always the main computer main screen
HOME THEATRE INPUT SETUP:         ———> HDMI#3 (ARC) — Onkyo HDMI output of whatever input the stereo is set to [usually computer, sometimes xbox/kinhank]
HOME THEATRE INPUT SETUP:         ———> HDMI#4 (MHL) — 3-way HDMI switcher, I think  [xbox360 on it rn]
HOME THEATRE INPUT SETUP:
HOME THEATRE INPUT SETUP: Demona HDMI#1 out ———> main TV HDMI#2 (TODO: add Gledopto 3.0 amblight, make sure splitter is ready-to-go if passthrough problems manifest)
HOME THEATRE INPUT SETUP: Demona HDMI#2 out ———> HDMI splitter__/———> audio extraction port ———> FM transmitter + bedroom RCA cable + downstairs RCA cable (DAC retired)
HOME THEATRE INPUT SETUP:       (top-rt scr)                    |———> output #1 ———————————————> top right TV (50" "Sceptre)
HOME THEATRE INPUT SETUP:                                       |———> output #2 ———————————————> Onkyo receiver
HOME THEATRE INPUT SETUP:                                       |———> output #3 ———————————————> Gledopto 1.0 ambilight
HOME THEATRE INPUT SETUP:                                       \———> output #4 ———————————————> TODO: run downstairs for hardline screen mirroring
HOME THEATRE INPUT SETUP: Demona HDMI#3 out ———> HDMI splitter__/———> secondary 52" TV
HOME THEATRE INPUT SETUP:                                       \———> secondary 52" TV's Gledopto 2.0 ambilight
HOME THEATRE INPUT SETUP: Demona HDMI#4 out ———> DVI adapter ———————> 20" monitor (1080p)
HOME THEATRE INPUT SETUP:
HOME THEATRE INPUT SETUP:   Xbox360 HDMI output ———> HDMI splitter __/———> Onkyo "Game" input
HOME THEATRE INPUT SETUP:                            HDMI splitter   \———> 3-way HDMI switcher ———> Main TV HDMI 4 (MHL)
HOME THEATRE INPUT SETUP:
HOME THEATRE INPUT SETUP:   Kinhank HDMI output ———> HDMI splitter __/———> Onkyo "Cable/Sat" input
HOME THEATRE INPUT SETUP:                            HDMI splitter   \———> 3-way HDMI switcher ———> Main TV HDMI 4 (MHL)
HOME THEATRE INPUT SETUP:
HOME THEATRE INPUT SETUP: Onkyo receiver output ———> HDMI switcher that connects to Main TV HDMI 3 (ARC) — set this for yes-gesture-control/publicc audio/all-sound-to-1-device
HOME THEATRE INPUT SETUP: [puposefully nothing] ———> HDMI switcher that connects to Main TV HDMI 3 (ARC) — set this for  no-gesture-control/private audio/separate sound to TV
HOME THEATRE INPUT SETUP:
HOME THEATRE INPUT SETUP:
other lines
other lines
other lines
other lines

And in this case, the glitch was usually 2-4 leaking ansi charcters at the end of the first highlighted "HOME THEATRE"




Seems that EVERY shell i throw this at does it consistently EXCEPT tcc

and i've noticed this about TCC for a good 15 years now

It's not a grep-specific thing, either. Leaking ansi has happened a lot, regardless of the source of ANSI. It's not as bad as it used to be (50% leak rate on some commands), but it's still bad (15% leak rate on a lot of commands, i have to see garbage on my screen every day randomly.)
 
I used to see this and I mentioned it in the forum more than once. As far as I can tell, it's the piping. My only guess is that when TCC starts (maybe stops or returns from) a transient instance (as in piping) ENABLE_VIRTUAL_TERMINAL_PROCESSING is momentarily removed from the console's output mode. Plugins are loaded by transient TCCs. So now, in at least two of my plugins, I add ENABLE_VIRTUAL_TERMINAL_PROCESSING at plugin load time and at plugin unload time. I haven't seen any control sequence failures since doing that.
 
I used to see this and I mentioned it in the forum more than once. As far as I can tell, it's the piping. My only guess is that when TCC starts (maybe stops or returns from) a transient instance (as in piping) ENABLE_VIRTUAL_TERMINAL_PROCESSING is momentarily removed from the console's output mode. Plugins are loaded by transient TCCs. So now, in at least two of my plugins, I add ENABLE_VIRTUAL_TERMINAL_PROCESSING at plugin load time and at plugin unload time. I haven't seen any control sequence failures since doing that.

Hmm. I'm using your WT plugin tho, so is that not one of them?
 
Super amazing that you figured all that out though!
 
Hmm. I'm using your WT plugin tho, so is that not one of them?
It is in the 4WT I made available a few days ago. Are you using that one? I don't know about the old one you have.

If you are using the new one then I gather the PseudoConsoleWindow is not becoming visible.

To be honest, I'm not sure I've figured it out. Since there are not a lot of complaints about VT control sequences in the WT forum, I'm just guessing that ENABLE_VIRTUAL_TERMINAL_PROCESSING is being momentarily removed.
 
@Vefactica - i had to revert that because of the white window stuff. so i'm using 4WT, but only the 2ⁿᵈ the latest version.

Mystery still needs solving. The same command that makes the same output to 1000 files should also do the same thing on the screen 1000 times, not... 850 or so.
 
@Vefactica - i had to revert that because of the white window stuff. so i'm using 4WT, but only the 2ⁿᵈ the latest version.
I put a new one in place after you reported the white window. On the server it's 2024-11-20 10:11 78,060 4wt.zip. Did you try it?

Code:
copy ftp://vefatica.net/4plugins/x64/4wt.zip
 
There's another thing that changed since I was seeing occasional corruption. My grep changed from 32-bit Gnu to 64-bit Gnu. Claire, is your grep 64-bit?
 
Okay, I installed the new version, and it did seem to help a lot!

I did get a rendering error on my FIRST try, but i couldn't make it happen a 2ⁿᵈ try.

So it wasn't 100%, but it seemingly brought the failure rate from 15% down to once-ever or <1%.



1732282776444.webp
 
[possible false alarm retracted until further research]


Side-note:

I'm also curious How this thread could this possibly be designated "Working as designed" when it's a thing that breaks in every command line except TCC. TCC is "designed" to break where others don't? There's a problem here and it seems to be swept under the rug for years now.
 
Last edited:
I can't tell for sure, but i think my grep.exe is 32-bit. It comes from my c:\cygwin\ folder and not my c:\cygwin64\ folder, though it doesn't self-identify in any way, so I'm not 100% sure.
 
I can't tell for sure, but i think my grep.exe is 32-bit. It comes from my c:\cygwin\ folder and not my c:\cygwin64\ folder, though it doesn't self-identify in any way, so I'm not 100% sure.

The @EXETYPE function may be useful here.
 
If you have 64-bit Gnu/Cygwin tools, use them exclusively. Note, Cygwin's tools are Gnu. As Charles said, @EXETYPE will tell you the bitness.

Code:
v:\> do d in /L d:\gnu d:\c64 ( echo %d & %d\grep --version | grep grep.*GNU & echo exetype = %@exetype[%d\grep.exe] )
d:\gnu
grep (GNU grep) 3.0
exetype = 10
d:\c64
grep (GNU grep) 3.10
exetype = 10
 
Huh. I would expect anything in the D:\C64 directory to be eight-bit....
Heh! I had one of those ... hacked "African Safari" and used control sequences to print fractal images on a Brother dot-matrix printer. Those were the days.
 
Update: it's a 64-bit grep i'm using

heck, maybe my whole \cygwin\ is 64-bit

i just know when i tried a new 64bit to \cygwin64\ , there was something that immediately made it a showstopper for me, so i stopped using that one. But in fact, both grep.exe's are identical haha
 
Back
Top