Mercurial > vim
comparison src/term.c @ 20500:03826c672315 v8.2.0804
patch 8.2.0804: libvterm code lags behind the upstream version
Commit: https://github.com/vim/vim/commit/e5886ccb5163873dd01fc67b09ab10e681351ee9
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 21 20:10:04 2020 +0200
patch 8.2.0804: libvterm code lags behind the upstream version
Problem: Libvterm code lags behind the upstream version.
Solution: Include revision 727, but add the index instead of switching
between RGB and indexed.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 21 May 2020 20:15:04 +0200 |
parents | d5d89c24eec7 |
children | bed30e6b5a09 |
comparison
equal
deleted
inserted
replaced
20499:a7a490678633 | 20500:03826c672315 |
---|---|
6355 static int grey_ramp[] = { | 6355 static int grey_ramp[] = { |
6356 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76, | 6356 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76, |
6357 0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE | 6357 0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE |
6358 }; | 6358 }; |
6359 | 6359 |
6360 # ifdef FEAT_TERMINAL | |
6361 # include "libvterm/include/vterm.h" // for VTERM_ANSI_INDEX_NONE | |
6362 # else | |
6363 # define VTERM_ANSI_INDEX_NONE 0 | |
6364 # endif | |
6365 | |
6366 static char_u ansi_table[16][4] = { | 6360 static char_u ansi_table[16][4] = { |
6367 // R G B idx | 6361 // R G B idx |
6368 { 0, 0, 0, 1}, // black | 6362 { 0, 0, 0, 1}, // black |
6369 {224, 0, 0, 2}, // dark red | 6363 {224, 0, 0, 2}, // dark red |
6370 { 0, 224, 0, 3}, // dark green | 6364 { 0, 224, 0, 3}, // dark green |
6382 {255, 64, 255, 14}, // light magenta | 6376 {255, 64, 255, 14}, // light magenta |
6383 { 64, 255, 255, 15}, // light cyan | 6377 { 64, 255, 255, 15}, // light cyan |
6384 {255, 255, 255, 16}, // white | 6378 {255, 255, 255, 16}, // white |
6385 }; | 6379 }; |
6386 | 6380 |
6381 #define ANSI_INDEX_NONE 0 | |
6382 | |
6387 void | 6383 void |
6388 cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx) | 6384 cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx) |
6389 { | 6385 { |
6390 int idx; | 6386 int idx; |
6391 | 6387 |
6401 // 216 color cube | 6397 // 216 color cube |
6402 idx = nr - 16; | 6398 idx = nr - 16; |
6403 *r = cube_value[idx / 36 % 6]; | 6399 *r = cube_value[idx / 36 % 6]; |
6404 *g = cube_value[idx / 6 % 6]; | 6400 *g = cube_value[idx / 6 % 6]; |
6405 *b = cube_value[idx % 6]; | 6401 *b = cube_value[idx % 6]; |
6406 *ansi_idx = VTERM_ANSI_INDEX_NONE; | 6402 *ansi_idx = ANSI_INDEX_NONE; |
6407 } | 6403 } |
6408 else if (nr < 256) | 6404 else if (nr < 256) |
6409 { | 6405 { |
6410 // 24 grey scale ramp | 6406 // 24 grey scale ramp |
6411 idx = nr - 232; | 6407 idx = nr - 232; |
6412 *r = grey_ramp[idx]; | 6408 *r = grey_ramp[idx]; |
6413 *g = grey_ramp[idx]; | 6409 *g = grey_ramp[idx]; |
6414 *b = grey_ramp[idx]; | 6410 *b = grey_ramp[idx]; |
6415 *ansi_idx = VTERM_ANSI_INDEX_NONE; | 6411 *ansi_idx = ANSI_INDEX_NONE; |
6416 } | 6412 } |
6417 else | 6413 else |
6418 { | 6414 { |
6419 *r = 0; | 6415 *r = 0; |
6420 *g = 0; | 6416 *g = 0; |
6421 *b = 0; | 6417 *b = 0; |
6422 *ansi_idx = 0; | 6418 *ansi_idx = ANSI_INDEX_NONE; |
6423 } | 6419 } |
6424 } | 6420 } |
6425 #endif | 6421 #endif |
6426 | 6422 |
6427 /* | 6423 /* |