Supporting ansicon?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

rconn

Administrator
Staff member
May 14, 2008
10,100
85
#2
with ansicon ( http://adoxa.110mb.com/ansicon/ ), I can make use of ANSI escape codes in prompt to have a colorful prompt.

It works in Windows cmd.exe and ReactOS cmd.exe, but I found that it doesn't work in TCC and LE.
It would be pointless, because TCC has ANSI support built-in (and has for a number of years).
 
#3
On Mon, 11 Jul 2011 21:31:12 -0400, roytam1 <> wrote:

|with ansicon ( http://adoxa.110mb.com/ansicon/ ), I can make use of ANSI escape codes in prompt to have a colorful prompt.
|
|It works in Windows cmd.exe and ReactOS cmd.exe, but I found that it doesn't work in TCC and LE.

TCC has ANSI built-in. OPTION ... Windows ... ANSI Colors ... check it (out).
 
#5
On Mon, 11 Jul 2011 23:08:48 -0400, roytam1 <> wrote:

|---Quote (Originally by rconn)---
|It would be pointless, because TCC has ANSI support built-in (and has for a number of years).
|---End Quote---
|But the color is different from ANSICON/PuTTY:
|http://i.imgur.com/5Txfs.png

Make a color bright with, for example, "$e[33;1m". The "$e[33m$[1m" which you
use is odd in my experience. I don't believe the standard is specific about
what happens if you use "$e[1m" alone.

According to Wiki,

CSI n [;k] m SGR – Select Graphic Rendition Sets SGR parameters, including
text color. After CSI can be zero or more parameters separated with ;. With no
parameters, CSI m is treated as CSI 0 m (reset / normal), which is typical of
most of the ANSI escape sequences.
 

rconn

Administrator
Staff member
May 14, 2008
10,100
85
#6
> ---Quote (Originally by rconn)---
> It would be pointless, because TCC has ANSI support built-in (and has
> for a number of years).
> ---End Quote---
> But the color is different from ANSICON/PuTTY:
> http://i.imgur.com/5Txfs.png
That's because your syntax is incorrect.

First, there's no "$e]0"; it should be "$e[0".

Second, you're setting a color and then turning it off and setting a
different color before displaying anything. If you want to combine them (to
make a bright color), you do it in a single escape sequence; i.e.
"$e[33;1m".

See " ANSI X3.64 Command Reference" in the help for details.

Rex Conn
JP Software
 
Apr 1, 2010
43
0
#7
That's because your syntax is incorrect.

First, there's no "$e]0"; it should be "$e[0".

Second, you're setting a color and then turning it off and setting a
different color before displaying anything. If you want to combine them (to
make a bright color), you do it in a single escape sequence; i.e.
"$e[33;1m".

See " ANSI X3.64 Command Reference" in the help for details.

Rex Conn
JP Software
$e]0 (Operating System Controls) is for changing the title, ansicon is in act but it can't take over TCC's ANSI logics.

Reference:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
 
Apr 1, 2010
43
0
#8
On Mon, 11 Jul 2011 23:08:48 -0400, roytam1 <> wrote:

|---Quote (Originally by rconn)---
|It would be pointless, because TCC has ANSI support built-in (and has for a number of years).
|---End Quote---
|But the color is different from ANSICON/PuTTY:
|http://i.imgur.com/5Txfs.png

Make a color bright with, for example, "$e[33;1m". The "$e[33m$[1m" which you
use is odd in my experience. I don't believe the standard is specific about
what happens if you use "$e[1m" alone.

According to Wiki,

CSI n [;k] m SGR – Select Graphic Rendition Sets SGR parameters, including
text color. After CSI can be zero or more parameters separated with ;. With no
parameters, CSI m is treated as CSI 0 m (reset / normal), which is typical of
most of the ANSI escape sequences.
But does anywhere in the ANSI escape code spec say that setting SGR standalone means resetting the color?
 
#9
On Tue, 12 Jul 2011 00:44:40 -0400, roytam1 <> wrote:

|---Quote (Originally by vefatica)---
|On Mon, 11 Jul 2011 23:08:48 -0400, roytam1 <> wrote:
|
||---Quote (Originally by rconn)---
||It would be pointless, because TCC has ANSI support built-in (and has for a number of years).
||---End Quote---
||But the color is different from ANSICON/PuTTY:
||http://i.imgur.com/5Txfs.png
|
|Make a color bright with, for example, "$e[33;1m". The "$e[33m$[1m" which you
|use is odd in my experience. I don't believe the standard is specific about
|what happens if you use "$e[1m" alone.
|
|According to Wiki,
|
|CSI n [;k] m SGR – Select Graphic Rendition Sets SGR parameters, including
|text color. After CSI can be zero or more parameters separated with ;. With no
|parameters, CSI m is treated as CSI 0 m (reset / normal), which is typical of
|most of the ANSI escape sequences.
|---End Quote---
|But does anywhere in the ANSI escape code spec say that setting SGR standalone means resetting the color?

I don't know for sure. For somewhat over $200 you can get a copy of the
original ANSI (or ISO) standard. I doubt it says specifically what happens to
color if you use "$e[1m" alone; that is, it's implementation dependent. All the
references I've seem refer to the $e[P[;P...]m format. Does it matter? Use
what works.
 
#10
On Tue, 12 Jul 2011 00:35:08 -0400, roytam1 <> wrote:

|$e]0 (Operating System Controls) is for changing the title, ansicon is in act but it can't take over TCC's ANSI logics.

In TCC you have control over the title with the TITLEPROMPT environment variable
(same formatting elements as PROMPT), the TITLE command, and the "UpdateTitle"
initialization directive.

I use "UpdateTitle=No" and TITLEPROMPT=$s[%_pid]$s$s$p.

And (FWIW) http://adoxa.110mb.com/ansicon/ANSI%20Prompt%20Colours.txt shows all
the possible color combos in the $e[p1[;P2...]m format.
 

rconn

Administrator
Staff member
May 14, 2008
10,100
85
#11
$e]0 (Operating System Controls) is for changing the title, ansicon is in act but it can't take over TCC's ANSI logics.

Reference:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
If you want to use ansicon (instead of using the correct TCC syntax), you'll have to get the ansicon author to fix his bugs.

Ansicon injects its code into other apps, which means any bugs or compatibility problems are absolutely, positively, 100% the fault of ansicon. TCC doesn't even know ansicon is intercepting the api's and rewriting output (but apparently not doing a very good job, at least with some apps).

You should refer this to the ansicon author.
 
#12
If you want to use ansicon (instead of using the correct TCC syntax), you'll have to get the ansicon author to fix his bugs.
I couldn't even get it to run. Here, COMSPEC is not set (except by individual shells). ANSICON.C has (essentially)

Code:
WCHAR *cmd;
// ...
// if COMSPEC is not set
cmd = L"cmd";
// ...
CreateProcess(NULL, cmd, ...
That (lpCommandLine in read-only memory) is a no-no. I reported this to the author.
 
May 31, 2008
376
2
#13
with ansicon ( http://adoxa.110mb.com/ansicon/ ), I can make use of ANSI escape codes in prompt to have a colorful prompt.

It works in Windows cmd.exe and ReactOS cmd.exe, but I found that it doesn't work in TCC and LE.
It would be pointless, because TCC has ANSI support built-in (and has for a number of years).
Well I just discovered that using ansicon to supplement built-in ANSI support isn't pointless after all. Unlike built-in ANSI, which isn't available to external programs according to help topic "ANSI X3.64 Command Reference", ansicom enables ANSI support for external programs that run in the console.

Which brings me to my question. Is there a built-in way to paginate files that include embedded ANSI codes? I tried //option ANSI=Yes + LIST or VIEW, but LIST and VIEW display raw control characters. TYPE alone displays ANSI escapes correctly but when I pipe it into LIST /S I get raw control characters again, likewise piping TYPE into MORE. So far the only working solution I could find is ansicon + MORE.

Alternatively, is there an easy way to strip off ANSI escapes from an input file?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,383
39
Albuquerque, NM
prospero.unm.edu
#14
Which brings me to my question. Is there a built-in way to paginate files that include embedded ANSI codes? I tried //option ANSI=Yes + LIST or VIEW, but LIST and VIEW display raw control characters. TYPE alone displays ANSI escapes correctly but when I pipe it into LIST /S I get raw control characters again, likewise piping TYPE into MORE. So far the only working solution I could find is ansicon + MORE.
How about TYPE /P ?
 
May 31, 2008
376
2
#16
Rex, TPIPE /simple=14 works great, thanks!
Charles, LIST /P does paginate but it's limited. I was looking for something more in the likes of LIST/VIEW, which can paginate and scroll back and forth, print, view, call editors, search etc. I think I will settle for stripping ANSI off with TPIPE.