Re: [msysGit] Re: Need your help with MinGW Issue 17: --color options don't work (produce garbage)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15/08/07, Dmitry Kakurin <dmitry.kakurin@xxxxxxxxx> wrote:
> On 8/15/07, Reece Dunn <msclrhd@xxxxxxxxxxxxxx> wrote:
> >
> > On 15/08/07, Dmitry Kakurin wrote:
> > > Here are the facts:
> > >
> > > 'git branch --color' produces garbage:
> > > $ git branch --color
> > >   devel←[m
> > >   dima←[m
> > >   dmitryk←[m
> > > * ←[32mmaster←[m
> > >   mob←[m
> > >   next←[m
> > >
> > > 'git branch --color | cat' produces expected colored output.
> > >
> > > I've traced it down to printf statement in gdb and it sends the right
> > > esc-sequence.
> > > Where should I look next?
> >
> > Windows doesn't recognise the *nix printf colour codes.
> >
> > Piping through cat will be going through cygwin/mingw emulation,
> > translating the colour codes to the correct API calls.
>
> That's my question. If there is a way to build cat.exe to do this kind
> of emulation under MinGW then I should be able to do the same for
> git.exe.
> I hope I just need to #define something while building Git.
> But what is it?

You will need to implement cat (or something similar) on MinGW that
will process the *nix colour codes and then pass that to
SetConsoleTextAttributes. For example:

    int ch = 0;
    while(( ch = getch()) != EOF )
    {
        if( /*ch is part of a colour sequence*/ )
        {
            SetConsoleTextAttribute( GetStdHandle(...),
win_color_from_color_sequence(...));
        }
        else putc( ch );
    }

I don't believe that MinGW has got this working for cat, that is why
one that supports colours on Windows needs to be written.

- Reece
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux