Welcome!

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

SignUp Now!

SOLVED: Request: @STRIPANSI[] function

No, only sequences stating with ESC [. That's my understanding of what ANSI sequences generally mean.

Sorry—I just now saw that you said "generally". My bad.

{rest of post retracted.. i'm finding bugs but i'm misidentifying them and need to be sure before commenting.. may have found an obscure bug in cygwin's grep and not tcc actually. trying to differentiate. i think it's grep}
 
It's worth a lot, actually. It makes the difference between certain things being possible for me, and not. It's 1 of 2 plugins i've ever used, the other doing some obscure windows terminal stuff that i forgot why i need.
 
Oh hey Charles... I just spent awhile combing through all my ANSI environment variables that i've put together after hours of research, and based on working BAT files with them for a year, asking people both in TCC and WT forums about why this and that are this and that...

... and have come to some conclusions. It turns out almost everything is now caught, yay.

However, .I have a ranked suggestion of codes to add to your plugin, if they aren't already. <begging emoji that can't be displayed here>



Those 2 sets of codes are:




1) Row locking ansi codes

The %[_rows] is not part of the code, but the %_ROWS TCC internal variable. You need to know it if you want to position the locked row correctly, it just has to be a number, as in regex \d{1,3} ... or d{1,4} if you think we'll get to 1000-row consoles someday :D

Locking rows at the top is a way to have scrollback be destroyed/confidental. It is by design
Locking rows at the bottom is a way to have status bars while preserving scrollback.

Both are good things. I like status bars that tell me what a BAT file is doing, because sometimes i'm doing so many things I"m not going to know, and osmetimes the tab title isn't visible enough (not as many characters!)

Code:
ANSI_UNLOCK_LOCKED_ROWS=7[s[0;%[_rows]r8[u
ANSI_UNLOCK_ROW=7[s[0;%[_rows]r8[u



2) The wonderfully strange and exciting wide lines:


Code:
ANSI_WIDE_LINE_ON=#6
ANSI_WIDE_LINE_OFF=#5


3) The one-off "move up one row" which totally works and is handy because prior to your plugin, the fewer characters one could achieve something, the closes %@LEN[] was to the printable length. I'm glad those days are over!!!! Thanks to you i might add. Not important, but it's maybe the most simple ansi code in existence that renders in windows terminal. Only 2 chars!

Code:
ANSI_MOVE_UP_ONE=M




4) Cursor color change codes

maybe you have these, but i think it's super useful to set cursor color based on error state, to know a red cursor means something bad happened, green something good, etc.. I also cycle it in tandem with my character-color-cycler (#1 thing for me to relieve hang anxiety, or hangxiety as i call it)

Code:
cursor_change_by_word=[ q]12;bright yellow%@CHAR[7]`
cursor_change_by_word=[ q]12;red%@CHAR[7]`
: (etc)

cursor_change_by_hex is the same as change_by_word, except that instead of values like "red", "Green", "Blue", the values are hexes like "#FF0000", "#00FF00", "#0000FF". So it's a #?[a-z\s0-9]+%@CHAR[7] regex situation for that part





5) You probably have these already, but possibly not. Changing cursor shape has been handy at times. Sometimes i'm doing visuals and want a less prominent cursor but don't want to make it completely invisible.

The CURSOR_COLOR_CHANGE ansi codes tend to not follow a lot of peoples' ansi regexes, because they use the \007 (yes, the beep) character

Code:
ANSI_CURSOR_CHANGE_TO_DEFAULT=[0 q
ANSI_CURSOR_CHANGE_TO_BLOCK_BLINKING=[1 q
ANSI_CURSOR_CHANGE_TO_BLOCK_STEADY=[2 q
ANSI_CURSOR_CHANGE_TO_UNDERLINE_BLINKING=[3 q
ANSI_CURSOR_CHANGE_TO_UNDERLINE_STEADY=[4 q
ANSI_CURSOR_CHANGE_TO_VERTICAL_BAR_BLINKING=[5 q
 ANSI_CURSOR_CHANGE_TO_VERTICAL_BAR_STEADY=[6 q


6) You probably have these too

Code:
ALTERNATE_SCREEN_BUFFER_ON=[?1049h
ALTERNATE_SCREEN_BUFFER_OFF=[?1049h

Get this! When grep outputs these codes, they still render even with //option ansi=no !!!!!!! It's what thwarted me grepping my ansi environment variables out and made this post 10X harder! lol It destroys scrollback.



99) I don't personally care about this one, but you CAN set tab stops in custom in windows terminal. I did it to fix the output of a tool that relied on tab stops and ended up with mismatched columns. I've never done it with THIS one before, though:

Code:
ANSI_TABSTOP_SET_COL=H



99999999) here's the leftover stuff i case you're curious: These are the only remaining ANSI (vVT10+220 codes, i read both manuals front to back) codes that anyone could possibly miss, but these last ones are esoteric voodoo that may not be currently implemented

Code:
ANSI_APP_PROGRAM_COMMAND=_
ANSI_DEVICE_ATTRIBUTES_QUERY=Z
ANSI_DEVICE_CONTROL_STRING=P
ANSI_HARD_TERMINAL_RESET=c
ANSI_IDENTIFY_HOST_TO_TERMINAL=Z
ANSI_SOS=X
ANSI_START_OF_STRING=X
ANSI_STRING_TERMINATOR=\
 
Annnnnnnnnnnnnnnnnnnnnnnnd apparantly there's a bug in the TCC forum where if you edit your past, all hardcoded ESCAPES are nuked. You'll just have to imagine them I guess. Dag-nabbit. I took a lot of care to hard-code them instead of using %@CHAR[27].

ARGH. I spent almost an hour on that post.


this is a reference for these same codes, in case it's unclear:

 
FWIW, I create my forum posts in another text editor,
and then transfer the post over via clipboard,
when I am ready to hit "post reply".

I have been bitten far too many times in the past.

When I want to post coloured text,
I post a screen shot,
from which the text can be easily extracted,
using the Microsoft PowerToys Text Extractor tool,
if needed.

Ref: PowerToys Text Extractor utility for Windows

Joe
 
using the Microsoft PowerToys Text Extractor tool,
if needed.
They put OCR into PowerToys? Nice. I loooooooooooooove Mouse Without Borders.
"No! Let go of your mouse! I'm moving it right now!"
 
Oh hey Charles... I just spent awhile combing through all my ANSI environment variables that i've put together after hours of research, and based on working BAT files with them for a year, asking people both in TCC and WT forums about why this and that are this and that...

... and have come to some conclusions. It turns out almost everything is now caught, yay.

However, .I have a ranked suggestion of codes to add to your plugin, if they aren't already. <begging emoji that can't be displayed here>

My word. That is a lot of ANSI sequences!

I've uploaded a new build which ought to catch the vast majority of them, including the OSC and Fp-type sequences.
 
Sorry that was such a hassle! But it's verrrrrrrrrrrrry appreciated!

And you know. Now you have a really good stripper. [this is my attempt at humor]

Screen positioning with ANSI has been tough at times, this really helps!
 
I've uploaded a new build which ought to catch the vast majority of them, including the OSC and Fp-type sequences.
I'm just curious and trying to be helpful.

I use OSC sequences to change themes in WT. Did you know ...

1. they can be terminated to either of two versions of ST (sequence terminator), namely

Code:
#define ST L"\x0007"   // (BEL) short version of Sequence Terminator 
#define ST1 L"\x001b\x005c" // (ESC \) long version of Sequence Terminator

2. they can be "chained" (at least in WT) ... several sequences inside one OSC/ST
 
I'm just curious and trying to be helpful.

I use OSC sequences to change themes in WT. Did you know ...

1. they can be terminated to either of two versions of ST (sequence terminator), namely

Code:
#define ST L"\x0007"   // (BEL) short version of Sequence Terminator
#define ST1 L"\x001b\x005c" // (ESC \) long version of Sequence Terminator

2. they can be "chained" (at least in WT) ... several sequences inside one OSC/ST

I'm allowing any of BEL, Esc-\, or 0x9C — the last being Unicode's "String Terminator" character, which Esc-\ remaps to.

I'm not entirely clear on what exactly is allowed between the OSC and the terminator, so I'm assuming any number of printable characters.
 
I'm not entirely clear on what exactly is allowed between the OSC and the terminator, so I'm assuming any number of printable characters.

That sounds safe. It'd be dumb not to read up to the ST even if there's garbage in between.

In a brief test, @char[0x9C] worked in a BTM for setting WT's theme. Thanks for that.
 
P.S., "dumb" ... I didn't mean you, I meant whoever might process the sequence.
 
What's the sequence for changing themes? How did you find that out???
 
I actually got online first using a dumb terminal (VT100, with the double-height text that i only experienced when my dad did work stuffs on it) in 1988.

Wasn't even a hayes modem. No ATDT ... just ... Control-T. And of course with no harddrive, you had to write those BBS numbers on paper....
 
What's the sequence for changing themes? How did you find that out???
I got them rummaging around in the WT source code (and doing a lot of editing). And I got help "chaining" the OSC sequences in the WT forum. A BTM is attached; it has 9 of them in BTM language. There are 3 others (CGA, Dark+, IBM 5153) that I have only in C code. @ClioCJS, if you're still using my 4WT plugin you might have a THEME command.

Code:
v:\> theme /?
THEME /L(ist) | index (0~11)

v:\> theme /L
 0 - Campbell
 1 - Campbell Powershell
 2 - CGA
 3 - Dark+
 4 - IBM 5153
 5 - One Half Dark
 6 - One Half Light
 7 - Solarized Dark
 8 - Solarized Light
 9 - Tango Dark
10 - Tango Light
11 - Vintage
 

Attachments

@ClioCJS, that BTM uses MY escape character (^) to form the ESC (^e) in the sequences. You have done so much with color that I figure you know how to do it in your ancient TCC.
 
@ClioCJS, that BTM uses MY escape character (^) to form the ESC (^e) in the sequences. You have done so much with color that I figure you know how to do it in your ancient TCC.
Never mind that stupid remark. I confused you with another gent.
 
I'm not a gent at all, if that helps with the confusion...
-Claire Jane
 
v31 is ancient now?!! hehe

I have the theme command actually! Sweet!
 
Are you still using my 4WT plugin? There might be a THEME command in there.
 
Does it have THEME? If so are there 8 themes or 11?

Code:
v:\> which theme
theme is a plugin command (4WT)

v:\> theme /L
 0 - Campbell
 1 - Campbell Powershell
 2 - CGA
 3 - Dark+
 4 - IBM 5153
 5 - One Half Dark
 6 - One Half Light
 7 - Solarized Dark
 8 - Solarized Light
 9 - Tango Dark
10 - Tango Light
11 - Vintage
 
Yup, 8!
1732045523016.webp
 
I put a new 4WT.ZIP on the server. It has 11 themes, maybe 1-2 other new things. This ought to get it.

Code:
copy ftp://vefatica.net/4plugins/x64/4wt.zip
 
I put a new 4WT.ZIP on the server. It has 11 themes, maybe 1-2 other new things. This ought to get it.

Code:
copy ftp://vefatica.net/4plugins/x64/4wt.zip
Thanks! I got it! 12 themes now!

Have you looked at colortool.exe?

I used it for my little trick of "Redefining the color black to be a slightly off-black shde of black, randomly" which fixed my accessibility problem of not being able to to tell where one TTCC ended and another began upon upgrade to windows 10 [which no longer permits customizable window-border-thickness and i'd used a 5px-wide borders all my life]

I'm still bothered that there's not a good way to find out how each color is defined other than manually tracking it. Ansi-query doesn't seem to work. I wanted this because i hard-reset them in some python libraries i wrote. So i'm hard resetting to MY colors instead of whatever they were prior.
 
Alas, I had to revert 4wt.dll to the version prior.

Any maximize/minimize of windows terminal would ruin the TCC window completely and utterly.

don't have a screenshot but.... imagine a big white box covering 80% of your screen. The contrast is so low that you can only barley discern that characters are in the box. The box is unmovable, and obscures the command line.

Sometimes it comes up without maximizing/minimizing. I ran into it in my AI-music-transcription process. It turned the entire window white and unusable. Tracked down. Reverted. Behavior stopped.

This is a TCC bug with WT unfortunately, and the new 4WT.dll somehow flushes it out on my system.
 
Is that big white box the same size (and initially, shape) as the WT window? It sounds like it's the PseudoConsoleWindow being shown. 4WT makes that window not-showable, and makes it follow the WT window in size and shape so that TCC can position things correctly. I did remove some stuff, thought unnecessary, lately. I'll try to backtrack. I hope you're willing to test a new one.
 
Back
Top