To: vim_dev@googlegroups.com Subject: Patch 7.4.1796 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1796 (after 7.4.1795) Problem: Colors are wrong on MS-Windows. (Christian Robinson) Solution: Use existing RGB macro if it exists. (Ken Takata) Files: src/term.c *** ../vim-7.4.1795/src/term.c 2016-04-26 22:33:11.913443804 +0200 --- src/term.c 2016-04-27 20:35:31.865622983 +0200 *************** *** 6068,6075 **** guicolor_T gui_get_color_cmn(char_u *name) { ! #define TORGB(r, g, b) ((r<<16) | (g<<8) | (b)) ! #define LINE_LEN 100 FILE *fd; char line[LINE_LEN]; char_u *fname; --- 6068,6079 ---- guicolor_T gui_get_color_cmn(char_u *name) { ! /* On MS-Windows an RGB macro is available and it's different from ours, ! * but does what is needed. */ ! # ifndef RGB ! # define RGB(r, g, b) ((r<<16) | (g<<8) | (b)) ! # endif ! # define LINE_LEN 100 FILE *fd; char line[LINE_LEN]; char_u *fname; *************** *** 6082,6144 **** }; static struct rgbcolor_table_S rgb_table[] = { ! {(char_u *)"black", TORGB(0x00, 0x00, 0x00)}, ! {(char_u *)"blue", TORGB(0x00, 0x00, 0xFF)}, ! {(char_u *)"brown", TORGB(0xA5, 0x2A, 0x2A)}, ! {(char_u *)"cyan", TORGB(0x00, 0xFF, 0xFF)}, ! {(char_u *)"darkblue", TORGB(0x00, 0x00, 0x8B)}, ! {(char_u *)"darkcyan", TORGB(0x00, 0x8B, 0x8B)}, ! {(char_u *)"darkgray", TORGB(0xA9, 0xA9, 0xA9)}, ! {(char_u *)"darkgreen", TORGB(0x00, 0x64, 0x00)}, ! {(char_u *)"darkgrey", TORGB(0xA9, 0xA9, 0xA9)}, ! {(char_u *)"darkmagenta", TORGB(0x8B, 0x00, 0x8B)}, ! {(char_u *)"darkred", TORGB(0x8B, 0x00, 0x00)}, ! {(char_u *)"darkyellow", TORGB(0x8B, 0x8B, 0x00)}, /* No X11 */ ! {(char_u *)"gray", TORGB(0xBE, 0xBE, 0xBE)}, ! {(char_u *)"gray10", TORGB(0x1A, 0x1A, 0x1A)}, ! {(char_u *)"gray20", TORGB(0x33, 0x33, 0x33)}, ! {(char_u *)"gray30", TORGB(0x4D, 0x4D, 0x4D)}, ! {(char_u *)"gray40", TORGB(0x66, 0x66, 0x66)}, ! {(char_u *)"gray50", TORGB(0x7F, 0x7F, 0x7F)}, ! {(char_u *)"gray60", TORGB(0x99, 0x99, 0x99)}, ! {(char_u *)"gray70", TORGB(0xB3, 0xB3, 0xB3)}, ! {(char_u *)"gray80", TORGB(0xCC, 0xCC, 0xCC)}, ! {(char_u *)"gray90", TORGB(0xE5, 0xE5, 0xE5)}, ! {(char_u *)"green", TORGB(0x00, 0xFF, 0x00)}, ! {(char_u *)"grey", TORGB(0xBE, 0xBE, 0xBE)}, ! {(char_u *)"grey10", TORGB(0x1A, 0x1A, 0x1A)}, ! {(char_u *)"grey20", TORGB(0x33, 0x33, 0x33)}, ! {(char_u *)"grey30", TORGB(0x4D, 0x4D, 0x4D)}, ! {(char_u *)"grey40", TORGB(0x66, 0x66, 0x66)}, ! {(char_u *)"grey50", TORGB(0x7F, 0x7F, 0x7F)}, ! {(char_u *)"grey60", TORGB(0x99, 0x99, 0x99)}, ! {(char_u *)"grey70", TORGB(0xB3, 0xB3, 0xB3)}, ! {(char_u *)"grey80", TORGB(0xCC, 0xCC, 0xCC)}, ! {(char_u *)"grey90", TORGB(0xE5, 0xE5, 0xE5)}, ! {(char_u *)"lightblue", TORGB(0xAD, 0xD8, 0xE6)}, ! {(char_u *)"lightcyan", TORGB(0xE0, 0xFF, 0xFF)}, ! {(char_u *)"lightgray", TORGB(0xD3, 0xD3, 0xD3)}, ! {(char_u *)"lightgreen", TORGB(0x90, 0xEE, 0x90)}, ! {(char_u *)"lightgrey", TORGB(0xD3, 0xD3, 0xD3)}, ! {(char_u *)"lightmagenta", TORGB(0xFF, 0x8B, 0xFF)}, /* No X11 */ ! {(char_u *)"lightred", TORGB(0xFF, 0x8B, 0x8B)}, /* No X11 */ ! {(char_u *)"lightyellow", TORGB(0xFF, 0xFF, 0xE0)}, ! {(char_u *)"magenta", TORGB(0xFF, 0x00, 0xFF)}, ! {(char_u *)"orange", TORGB(0xFF, 0xA5, 0x00)}, ! {(char_u *)"purple", TORGB(0xA0, 0x20, 0xF0)}, ! {(char_u *)"red", TORGB(0xFF, 0x00, 0x00)}, ! {(char_u *)"seagreen", TORGB(0x2E, 0x8B, 0x57)}, ! {(char_u *)"slateblue", TORGB(0x6A, 0x5A, 0xCD)}, ! {(char_u *)"violet", TORGB(0xEE, 0x82, 0xEE)}, ! {(char_u *)"white", TORGB(0xFF, 0xFF, 0xFF)}, ! {(char_u *)"yellow", TORGB(0xFF, 0xFF, 0x00)}, }; if (name[0] == '#' && STRLEN(name) == 7) { /* Name is in "#rrggbb" format */ ! color = TORGB(((hex_digit(name[1]) << 4) + hex_digit(name[2])), ((hex_digit(name[3]) << 4) + hex_digit(name[4])), ((hex_digit(name[5]) << 4) + hex_digit(name[6]))); if (color > 0xffffff) --- 6086,6148 ---- }; static struct rgbcolor_table_S rgb_table[] = { ! {(char_u *)"black", RGB(0x00, 0x00, 0x00)}, ! {(char_u *)"blue", RGB(0x00, 0x00, 0xFF)}, ! {(char_u *)"brown", RGB(0xA5, 0x2A, 0x2A)}, ! {(char_u *)"cyan", RGB(0x00, 0xFF, 0xFF)}, ! {(char_u *)"darkblue", RGB(0x00, 0x00, 0x8B)}, ! {(char_u *)"darkcyan", RGB(0x00, 0x8B, 0x8B)}, ! {(char_u *)"darkgray", RGB(0xA9, 0xA9, 0xA9)}, ! {(char_u *)"darkgreen", RGB(0x00, 0x64, 0x00)}, ! {(char_u *)"darkgrey", RGB(0xA9, 0xA9, 0xA9)}, ! {(char_u *)"darkmagenta", RGB(0x8B, 0x00, 0x8B)}, ! {(char_u *)"darkred", RGB(0x8B, 0x00, 0x00)}, ! {(char_u *)"darkyellow", RGB(0x8B, 0x8B, 0x00)}, /* No X11 */ ! {(char_u *)"gray", RGB(0xBE, 0xBE, 0xBE)}, ! {(char_u *)"gray10", RGB(0x1A, 0x1A, 0x1A)}, ! {(char_u *)"gray20", RGB(0x33, 0x33, 0x33)}, ! {(char_u *)"gray30", RGB(0x4D, 0x4D, 0x4D)}, ! {(char_u *)"gray40", RGB(0x66, 0x66, 0x66)}, ! {(char_u *)"gray50", RGB(0x7F, 0x7F, 0x7F)}, ! {(char_u *)"gray60", RGB(0x99, 0x99, 0x99)}, ! {(char_u *)"gray70", RGB(0xB3, 0xB3, 0xB3)}, ! {(char_u *)"gray80", RGB(0xCC, 0xCC, 0xCC)}, ! {(char_u *)"gray90", RGB(0xE5, 0xE5, 0xE5)}, ! {(char_u *)"green", RGB(0x00, 0xFF, 0x00)}, ! {(char_u *)"grey", RGB(0xBE, 0xBE, 0xBE)}, ! {(char_u *)"grey10", RGB(0x1A, 0x1A, 0x1A)}, ! {(char_u *)"grey20", RGB(0x33, 0x33, 0x33)}, ! {(char_u *)"grey30", RGB(0x4D, 0x4D, 0x4D)}, ! {(char_u *)"grey40", RGB(0x66, 0x66, 0x66)}, ! {(char_u *)"grey50", RGB(0x7F, 0x7F, 0x7F)}, ! {(char_u *)"grey60", RGB(0x99, 0x99, 0x99)}, ! {(char_u *)"grey70", RGB(0xB3, 0xB3, 0xB3)}, ! {(char_u *)"grey80", RGB(0xCC, 0xCC, 0xCC)}, ! {(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)}, ! {(char_u *)"lightblue", RGB(0xAD, 0xD8, 0xE6)}, ! {(char_u *)"lightcyan", RGB(0xE0, 0xFF, 0xFF)}, ! {(char_u *)"lightgray", RGB(0xD3, 0xD3, 0xD3)}, ! {(char_u *)"lightgreen", RGB(0x90, 0xEE, 0x90)}, ! {(char_u *)"lightgrey", RGB(0xD3, 0xD3, 0xD3)}, ! {(char_u *)"lightmagenta", RGB(0xFF, 0x8B, 0xFF)}, /* No X11 */ ! {(char_u *)"lightred", RGB(0xFF, 0x8B, 0x8B)}, /* No X11 */ ! {(char_u *)"lightyellow", RGB(0xFF, 0xFF, 0xE0)}, ! {(char_u *)"magenta", RGB(0xFF, 0x00, 0xFF)}, ! {(char_u *)"orange", RGB(0xFF, 0xA5, 0x00)}, ! {(char_u *)"purple", RGB(0xA0, 0x20, 0xF0)}, ! {(char_u *)"red", RGB(0xFF, 0x00, 0x00)}, ! {(char_u *)"seagreen", RGB(0x2E, 0x8B, 0x57)}, ! {(char_u *)"slateblue", RGB(0x6A, 0x5A, 0xCD)}, ! {(char_u *)"violet", RGB(0xEE, 0x82, 0xEE)}, ! {(char_u *)"white", RGB(0xFF, 0xFF, 0xFF)}, ! {(char_u *)"yellow", RGB(0xFF, 0xFF, 0x00)}, }; if (name[0] == '#' && STRLEN(name) == 7) { /* Name is in "#rrggbb" format */ ! color = RGB(((hex_digit(name[1]) << 4) + hex_digit(name[2])), ((hex_digit(name[3]) << 4) + hex_digit(name[4])), ((hex_digit(name[5]) << 4) + hex_digit(name[6]))); if (color > 0xffffff) *************** *** 6188,6194 **** if (STRICMP(line + pos, name) == 0) { fclose(fd); ! return (guicolor_T) TORGB(r, g, b); } } fclose(fd); --- 6192,6198 ---- if (STRICMP(line + pos, name) == 0) { fclose(fd); ! return (guicolor_T)RGB(r, g, b); } } fclose(fd); *** ../vim-7.4.1795/src/version.c 2016-04-26 22:33:11.913443804 +0200 --- src/version.c 2016-04-27 20:34:51.342085195 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1796, /**/ -- ARTHUR: Go on, Bors, chop its head off. BORS: Right. Silly little bleeder. One rabbit stew coming up. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///