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

colorization outside of type

Discussion in 'Support' started by Eric Pement, Jul 16, 2008.

  1. Eric Pement

    Joined:
    Jun 28, 2008
    Messages:
    12
    Likes Received:
    0
    I use a lot of little Unix tools with TCmd and if I want to get ANSI color, I have been piping my output through the TYPE command. E.g.,
    Code:
    grep --color=always "pattern" file | type
    However, is there another way to get ANSI or color support for external utilities other than using TYPE? Or is piping the output through TYPE pretty much the only way?
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Eric Pement wrote:
    | I use a lot of little Unix tools with TCmd and if I want to get ANSI
    | color, I have been piping my output through the TYPE command. E.g.,
    |
    | Code:
    | ---------
    | grep --color=always "pattern" file | type
    | ---------
    | However, is there another way to get ANSI or color support for
    | external utilities *other* than using TYPE? Or is piping the output
    | through TYPE pretty much the only way?

    Usefully TYPE only. The support is in the STDOUT handler, which interprets
    many (though not all) X3.64 escape sequences. Other methods work as well,
    but are really much clumsier. For example:

    command | for %x in (@con) echo %x

    which is really equivalent to

    command | type
    --
    HTH, Steve
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,053
    Likes Received:
    30
    On Wed, 16 Jul 2008 10:38:37 -0500, Eric Pement <> wrote:


    TCC can only color what TCC outputs. I doubt even the possibility of
    console-wide SNAI color support; that would have to be done by csrss.exe.

    It would seem, however, that TCMD could add ANSI color support for anything
    running in a tab. Since TCMD has to reproduce what it finds in the console
    screen buffer, it could scan for ANSI sequences and colorize what appears in its
    window appropriately. How well that might work, and whether the demand would be
    worth the effort are still other questions.
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    vefatica wrote:
    | On Wed, 16 Jul 2008 10:38:37 -0500, Eric Pement <> wrote:
    |
    |
    |
    | ---Quote---
    || However, is there another way to get ANSI or color support for
    || external utilities *other* than using TYPE? Or is piping the output
    || through TYPE pretty much the only way?
    | ---End Quote---
    | TCC can only color what TCC outputs. I doubt even the possibility of
    | console-wide SNAI color support; that would have to be done by
    | csrss.exe.
    |
    | It would seem, however, that TCMD could add ANSI color support for
    | anything running in a tab. Since TCMD has to reproduce what it finds
    | in the console screen buffer, it could scan for ANSI sequences and
    | colorize what appears in its window appropriately. How well that
    | might work, and whether the demand would be worth the effort are
    | still other questions.

    The possibility of copying the X3.64 interpreter code into TCMD, and even of
    emulating of a VT-440 is real (only a small subset of that code is now in
    TCC). I used the original TCMD16 instead of 4NT because it was the only
    available X3.64 on WinNT. The *nix terminal managers do include X3.64
    interpreters. The real issue for Rex is its commercial value - if any. If it
    does not sell even one more copy of TCMD, why do it?
    --
    Steve
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,053
    Likes Received:
    30
    On Wed, 16 Jul 2008 13:40:05 -0500, Steve Fábián <> wrote:


    There's also the question of whether it could be fast enough so that TCMD's
    emulation of a console wouldn't suffer.
     
  6. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    vefatica wrote:
    | On Wed, 16 Jul 2008 13:40:05 -0500, Steve Fábián <> wrote:
    | ---Quote---
    || The possibility of copying the X3.64 interpreter code into TCMD, and
    || even of emulating of a VT-440 is real (only a small subset of that
    || code is now in TCC). I used the original TCMD16 instead of 4NT
    || because it was the only available X3.64 on WinNT. The *nix terminal
    || managers do include X3.64 interpreters. The real issue for Rex is
    || its commercial value - if any. If it does not sell even one more
    || copy of TCMD, why do it?
    | ---End Quote---
    | There's also the question of whether it could be fast enough so that
    | TCMD's emulation of a console wouldn't suffer.

    I doubt speed is an issue. If one wants the feature, one may suffer a minor
    degradation of console draring speed.
    --
    Steve
     
  7. xybre

    Joined:
    Mar 20, 2009
    Messages:
    1
    Likes Received:
    0
    Type doesn't always work, this does:
    http://www.geocities.com/jadoxa/ansicon/index.html

    It can also act as an intermediary for TCC and interpret the ANSI codes on the fly. Its apparently not as hard to do as previously thought, so I'm kinda disappointed its not supported in TC by default.
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,991
    Likes Received:
    84
    It's much more difficult than you apparently think. ANSICON patches other
    program's IATs and injects a dll into their address space, which only works
    for some programs and some systems. (And, IMO, it's risky behavior that can
    cause serious problems.) It also only intercepts two possible console APIs,
    so it won't work with programs that use any of the other console APIs. And
    it is DEFINITELY not behavior that belongs in a command interpreter.

    But it probably doesn't matter, since other than TCC there are almost no
    win32 apps that support ANSI sequences anyway.

    Rex Conn
    JP Software
     

Share This Page