Patch 8.0.0831 (after 8.0.0791)
Problem: With 8 colors the bold attribute is not set properly.
Solution: Move setting HL_TABLE() out of lookup_color. (closes #1901)
Files: src/syntax.c, src/proto/syntax.pro, src/terminal.c
*** ../vim-8.0.0830/src/syntax.c 2017-07-31 22:29:29.800202678 +0200
--- src/syntax.c 2017-08-01 17:57:25.717546848 +0200
***************
*** 7276,7284 ****
/*
* Lookup the "cterm" value to be used for color with index "idx" in
* color_names[].
*/
int
! lookup_color(int idx, int foreground)
{
int color = color_numbers_16[idx];
char_u *p;
--- 7276,7286 ----
/*
* Lookup the "cterm" value to be used for color with index "idx" in
* color_names[].
+ * "boldp" will be set to TRUE or FALSE for a foreground color when using 8
+ * colors, otherwise it will be unchanged.
*/
int
! lookup_color(int idx, int foreground, int *boldp)
{
int color = color_numbers_16[idx];
char_u *p;
***************
*** 7300,7311 ****
/* set/reset bold attribute to get light foreground
* colors (on some terminals, e.g. "linux") */
if (color & 8)
! {
! HL_TABLE()[idx].sg_cterm |= HL_BOLD;
! HL_TABLE()[idx].sg_cterm_bold = TRUE;
! }
else
! HL_TABLE()[idx].sg_cterm &= ~HL_BOLD;
}
color &= 7; /* truncate to 8 colors */
}
--- 7302,7310 ----
/* set/reset bold attribute to get light foreground
* colors (on some terminals, e.g. "linux") */
if (color & 8)
! *boldp = TRUE;
else
! *boldp = FALSE;
}
color &= 7; /* truncate to 8 colors */
}
***************
*** 7837,7842 ****
--- 7836,7843 ----
}
else
{
+ int bold = MAYBE;
+
#if defined(__QNXNTO__)
static int *color_numbers_8_qansi = color_numbers_8;
/* On qnx, the 8 & 16 color arrays are the same */
***************
*** 7857,7863 ****
break;
}
! color = lookup_color(i, key[5] == 'F');
}
/* Add one to the argument, to avoid zero. Zero is used for
--- 7858,7874 ----
break;
}
! color = lookup_color(i, key[5] == 'F', &bold);
!
! /* set/reset bold attribute to get light foreground
! * colors (on some terminals, e.g. "linux") */
! if (bold == TRUE)
! {
! HL_TABLE()[idx].sg_cterm |= HL_BOLD;
! HL_TABLE()[idx].sg_cterm_bold = TRUE;
! }
! else if (bold == FALSE)
! HL_TABLE()[idx].sg_cterm &= ~HL_BOLD;
}
/* Add one to the argument, to avoid zero. Zero is used for
*** ../vim-8.0.0830/src/proto/syntax.pro 2017-07-28 15:11:34.267537205
+0200
--- src/proto/syntax.pro 2017-08-01 17:57:13.645634248 +0200
***************
*** 23,29 ****
char_u *get_syntime_arg(expand_T *xp, int idx);
void init_highlight(int both, int reset);
int load_colors(char_u *name);
! int lookup_color(int idx, int foreground);
void do_highlight(char_u *line, int forceit, int init);
void free_highlight(void);
void restore_cterm_colors(void);
--- 23,29 ----
char_u *get_syntime_arg(expand_T *xp, int idx);
void init_highlight(int both, int reset);
int load_colors(char_u *name);
! int lookup_color(int idx, int foreground, int *boldp);
void do_highlight(char_u *line, int forceit, int init);
void free_highlight(void);
void restore_cterm_colors(void);
*** ../vim-8.0.0830/src/terminal.c 2017-07-31 21:18:54.830417800 +0200
--- src/terminal.c 2017-08-01 17:57:02.021718405 +0200
***************
*** 36,42 ****
* that buffer, attributes come from the scrollback buffer tl_scrollback.
*
* TODO:
! * - Use "." for current line instead of optional.
* - make row and cols one-based instead of zero-based in term_ functions.
* - Add StatusLineTerm highlighting
* - in bash mouse clicks are inserting characters.
--- 36,42 ----
* that buffer, attributes come from the scrollback buffer tl_scrollback.
*
* TODO:
! * - Use "." for current line instead of optional argument.
* - make row and cols one-based instead of zero-based in term_ functions.
* - Add StatusLineTerm highlighting
* - in bash mouse clicks are inserting characters.
***************
*** 56,61 ****
--- 56,63 ----
* - do not store terminal window in viminfo. Or prefix term:// ?
* - add a character in :ls output
* - add 't' to mode()
+ * - When making a change after the job has ended, make the buffer a normal
+ * buffer; needs to be written.
* - when closing window and job has not ended, make terminal hidden?
* - when closing window and job has ended, make buffer hidden?
* - don't allow exiting Vim when a terminal is still running a job
***************
*** 71,76 ****
--- 73,80 ----
* conversions.
* - update ":help function-list" for terminal functions.
* - In the GUI use a terminal emulator for :!cmd.
+ * - Copy text in the vterm to the Vim buffer once in a while, so that
+ * completion works.
*/
#include "vim.h"
***************
*** 1253,1259 ****
* First color is 1. Return 0 if no match found.
*/
static int
! color2index(VTermColor *color, int foreground)
{
int red = color->red;
int blue = color->blue;
--- 1257,1263 ----
* First color is 1. Return 0 if no match found.
*/
static int
! color2index(VTermColor *color, int fg, int *boldp)
{
int red = color->red;
int blue = color->blue;
***************
*** 1265,1280 ****
if (green == 0)
{
if (blue == 0)
! return lookup_color(0, foreground) + 1; /* black */
if (blue == 224)
! return lookup_color(1, foreground) + 1; /* dark blue */
}
else if (green == 224)
{
if (blue == 0)
! return lookup_color(2, foreground) + 1; /* dark green */
if (blue == 224)
! return lookup_color(3, foreground) + 1; /* dark cyan */
}
}
else if (red == 224)
--- 1269,1284 ----
if (green == 0)
{
if (blue == 0)
! return lookup_color(0, fg, boldp) + 1; /* black */
if (blue == 224)
! return lookup_color(1, fg, boldp) + 1; /* dark blue */
}
else if (green == 224)
{
if (blue == 0)
! return lookup_color(2, fg, boldp) + 1; /* dark green */
if (blue == 224)
! return lookup_color(3, fg, boldp) + 1; /* dark cyan */
}
}
else if (red == 224)
***************
*** 1282,1319 ****
if (green == 0)
{
if (blue == 0)
! return lookup_color(4, foreground) + 1; /* dark red */
if (blue == 224)
! return lookup_color(5, foreground) + 1; /* dark magenta */
}
else if (green == 224)
{
if (blue == 0)
! return lookup_color(6, foreground) + 1; /* dark yellow / brown
*/
if (blue == 224)
! return lookup_color(8, foreground) + 1; /* white / light grey */
}
}
else if (red == 128)
{
if (green == 128 && blue == 128)
! return lookup_color(12, foreground) + 1; /* high intensity black /
dark grey */
}
else if (red == 255)
{
if (green == 64)
{
if (blue == 64)
! return lookup_color(20, foreground) + 1; /* light red */
if (blue == 255)
! return lookup_color(22, foreground) + 1; /* light magenta */
}
else if (green == 255)
{
if (blue == 64)
! return lookup_color(24, foreground) + 1; /* yellow */
if (blue == 255)
! return lookup_color(26, foreground) + 1; /* white */
}
}
else if (red == 64)
--- 1286,1323 ----
if (green == 0)
{
if (blue == 0)
! return lookup_color(4, fg, boldp) + 1; /* dark red */
if (blue == 224)
! return lookup_color(5, fg, boldp) + 1; /* dark magenta */
}
else if (green == 224)
{
if (blue == 0)
! return lookup_color(6, fg, boldp) + 1; /* dark yellow / brown */
if (blue == 224)
! return lookup_color(8, fg, boldp) + 1; /* white / light grey */
}
}
else if (red == 128)
{
if (green == 128 && blue == 128)
! return lookup_color(12, fg, boldp) + 1; /* high intensity black /
dark grey */
}
else if (red == 255)
{
if (green == 64)
{
if (blue == 64)
! return lookup_color(20, fg, boldp) + 1; /* light red */
if (blue == 255)
! return lookup_color(22, fg, boldp) + 1; /* light magenta */
}
else if (green == 255)
{
if (blue == 64)
! return lookup_color(24, fg, boldp) + 1; /* yellow */
if (blue == 255)
! return lookup_color(26, fg, boldp) + 1; /* white */
}
}
else if (red == 64)
***************
*** 1321,1334 ****
if (green == 64)
{
if (blue == 255)
! return lookup_color(14, foreground) + 1; /* light blue */
}
else if (green == 255)
{
if (blue == 64)
! return lookup_color(16, foreground) + 1; /* light green */
if (blue == 255)
! return lookup_color(18, foreground) + 1; /* light cyan */
}
}
if (t_colors >= 256)
--- 1325,1338 ----
if (green == 64)
{
if (blue == 255)
! return lookup_color(14, fg, boldp) + 1; /* light blue */
}
else if (green == 255)
{
if (blue == 64)
! return lookup_color(16, fg, boldp) + 1; /* light green */
if (blue == 255)
! return lookup_color(18, fg, boldp) + 1; /* light cyan */
}
}
if (t_colors >= 256)
***************
*** 1399,1406 ****
else
#endif
{
! return get_cterm_attr_idx(attr, color2index(&cell->fg, TRUE),
! color2index(&cell->bg, FALSE));
}
return 0;
}
--- 1403,1416 ----
else
#endif
{
! int bold = MAYBE;
! int fg = color2index(&cell->fg, TRUE, &bold);
! int bg = color2index(&cell->bg, FALSE, &bold);
!
! /* with 8 colors set the bold attribute to get a bright foreground */
! if (bold == TRUE)
! attr |= HL_BOLD;
! return get_cterm_attr_idx(attr, fg, bg);
}
return 0;
}
*** ../vim-8.0.0830/src/version.c 2017-08-01 17:40:16.224985961 +0200
--- src/version.c 2017-08-01 17:51:37.700067352 +0200
***************
*** 771,772 ****
--- 771,774 ----
{ /* Add new patch number below this line */
+ /**/
+ 831,
/**/
--
"A mouse can be just as dangerous as a bullet or a bomb."
(US Representative Lamar Smith, R-Texas)
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
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].
For more options, visit https://groups.google.com/d/optout.