Fri, 7 May 2010 13:31:07 -0500, /Steve Borho/:
On Fri, May 7, 2010 at 1:28 PM, Steve Borho <st...@borho.org> wrote:
On Fri, May 7, 2010 at 1:23 PM, Stanimir Stamenkov <s7a...@netscape.net> wrote:

but only:

    w32effects = {
        ...
        'black_background': 0,
        'red_background': BACKGROUND_RED,
        'green_background': BACKGROUND_GREEN,
        'blue_background': BACKGROUND_BLUE,
        'cyan_background': BACKGROUND_BLUE | BACKGROUND_GREEN,
        ...

Is there a particular reason the 'yellow', 'purple' and 'white' backgrounds are omitted for the win32 console?

I didn't find them here:

http://msdn.microsoft.com/en-us/library/ms682088%28VS.85%29.aspx

I'll also say I didn't experiment much with OR'ing all the combinations. If you find a combination that works for any of those other tags, let me know and I'll be glad to add them.

I've recently tried out the Win32 Console APIs (see "unicode_test.cpp" attached) for other than the color attributes but tried them too, and I can see all background color combinations are effective. I guess one just need to add these:

diff -r 502474839293 hgext/color.py
--- a/hgext/color.py    Wed May 05 20:21:57 2010 -0500
+++ b/hgext/color.py    Fri May 07 22:15:15 2010 +0300
@@ -235,8 +235,11 @@
         'black_background': 0,
         'red_background': BACKGROUND_RED,
         'green_background': BACKGROUND_GREEN,
+        'yellow_background': BACKGROUND_RED | BACKGROUND_GREEN,
         'blue_background': BACKGROUND_BLUE,
+        'purple_background': BACKGROUND_BLUE | BACKGROUND_RED,
         'cyan_background': BACKGROUND_BLUE | BACKGROUND_GREEN,
+        'white_background': BACKGROUND_RED | BACKGROUND_GREEN | 
BACKGROUND_BLUE,
         'bold_background': BACKGROUND_INTENSITY,
         'underline': COMMON_LVB_UNDERSCORE,     # double-byte charsets only
         'inverse': COMMON_LVB_REVERSE_VIDEO,    # double-byte charsets only

but I can't build Mercurial myself to verify.

--
Stanimir
#include <tchar.h>
#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
    HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
    DWORD ignore;

    for (int i = 0; i < (0x1 << 4); i++) {
        WORD bkgAtts = 0;
        bkgAtts |= (i & 0x1) ? BACKGROUND_BLUE : 0;
        bkgAtts |= (i & 0x2) ? BACKGROUND_GREEN : 0;
        bkgAtts |= (i & 0x4) ? BACKGROUND_RED : 0;
        bkgAtts |= (i & 0x8) ? BACKGROUND_INTENSITY : 0;

        for (int j = 0; j < (0x1 << 4); j++) {
            WORD atts = bkgAtts;
            atts |= (j & 0x1) ? FOREGROUND_BLUE : 0;
            atts |= (j & 0x2) ? FOREGROUND_GREEN : 0;
            atts |= (j & 0x4) ? FOREGROUND_RED : 0;
            atts |= (j & 0x8) ? FOREGROUND_INTENSITY : 0;
            SetConsoleTextAttribute(console, atts);
            WriteConsole(console,
                         _T("\xE0\xE1\xE2\xE9\xEA\xEB"),
                         6, &ignore, NULL);
            WriteConsole(console,
                         _T("\x3B1\x3B2\x3B3\x3B4\x3B5\x3B6"),
                         6, &ignore, NULL);
            WriteConsole(console,
                         _T("\x430\x431\x432\x433\x434\x435"),
                         6, &ignore, NULL);
            WriteConsole(console,
                         _T("\x3042\x3044\x3046\x3048\x304A\x304B"),
                         6, &ignore, NULL);
            _puttch(_T('\n'));
        }
    }

    // Reset color.
    SetConsoleTextAttribute(console,
            FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);

    return 0;
}
------------------------------------------------------------------------------

_______________________________________________
Tortoisehg-discuss mailing list
Tortoisehg-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-discuss

Reply via email to