Patch 8.2.4852
Problem:    ANSI color index to RGB value not correct.
Solution:   Convert the cterm index to ANSI index. (closes #10321,
            closes #9836))
Files:      src/term.c


*** ../vim-8.2.4851/src/term.c  2022-04-27 11:57:57.581002707 +0100
--- src/term.c  2022-05-01 17:41:11.334948207 +0100
***************
*** 6761,6785 ****
  };
  
  static char_u ansi_table[16][4] = {
! //   R    G    B   idx
!   {  0,   0,   0,  1}, // black
!   {224,   0,   0,  2}, // dark red
!   {  0, 224,   0,  3}, // dark green
!   {224, 224,   0,  4}, // dark yellow / brown
!   {  0,   0, 224,  5}, // dark blue
!   {224,   0, 224,  6}, // dark magenta
!   {  0, 224, 224,  7}, // dark cyan
!   {224, 224, 224,  8}, // light grey
! 
!   {128, 128, 128,  9}, // dark grey
!   {255,  64,  64, 10}, // light red
!   { 64, 255,  64, 11}, // light green
!   {255, 255,  64, 12}, // yellow
!   { 64,  64, 255, 13}, // light blue
!   {255,  64, 255, 14}, // light magenta
!   { 64, 255, 255, 15}, // light cyan
!   {255, 255, 255, 16}, // white
  };
  
  #define ANSI_INDEX_NONE 0
  
--- 6761,6792 ----
  };
  
  static char_u ansi_table[16][4] = {
! //   R    G    B
!   {  0,   0,   0}, // black
!   {224,   0,   0}, // dark red
!   {  0, 224,   0}, // dark green
!   {224, 224,   0}, // dark yellow / brown
!   {  0,   0, 224}, // dark blue
!   {224,   0, 224}, // dark magenta
!   {  0, 224, 224}, // dark cyan
!   {224, 224, 224}, // light grey
! 
!   {128, 128, 128}, // dark grey
!   {255,  64,  64}, // light red
!   { 64, 255,  64}, // light green
!   {255, 255,  64}, // yellow
!   { 64,  64, 255}, // light blue
!   {255,  64, 255}, // light magenta
!   { 64, 255, 255}, // light cyan
!   {255, 255, 255}, // white
! };
! 
! #if defined(MSWIN)
! // Mapping between cterm indices < 16 and their counterpart in the ANSI 
palette.
! static const char_u cterm_ansi_idx[] = {
!     0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15
  };
+ #endif
  
  #define ANSI_INDEX_NONE 0
  
***************
*** 6790,6799 ****
  
      if (nr < 16)
      {
!       *r = ansi_table[nr][0];
!       *g = ansi_table[nr][1];
!       *b = ansi_table[nr][2];
!       *ansi_idx = ansi_table[nr][3];
      }
      else if (nr < 232)
      {
--- 6797,6811 ----
  
      if (nr < 16)
      {
! #if defined(MSWIN)
!       idx = cterm_ansi_idx[nr];
! #else
!       idx = nr;
! #endif
!       *r = ansi_table[idx][0];
!       *g = ansi_table[idx][1];
!       *b = ansi_table[idx][2];
!       *ansi_idx = idx + 1;
      }
      else if (nr < 232)
      {
*** ../vim-8.2.4851/src/version.c       2022-05-01 00:42:16.046989890 +0100
--- src/version.c       2022-05-01 17:42:52.298817524 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4852,
  /**/

-- 
>From "know your smileys":
 :-{}   Too much lipstick

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220501164415.2EF3B1C47D0%40moolenaar.net.

Raspunde prin e-mail lui