mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 22:38:16 +00:00
ui: Test for abstract_ui whenever a minimal t_colors value is required
t_colors should not be checked when abstract_ui is active, because nvim UI is not limited to a terminal.
This commit is contained in:
@@ -2294,8 +2294,7 @@ static int pum_wanted(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* The display looks bad on a B&W display. */
|
/* The display looks bad on a B&W display. */
|
||||||
if (t_colors < 8
|
if (!abstract_ui && t_colors < 8)
|
||||||
)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -14440,7 +14440,7 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv)
|
|||||||
if (modec != 't' && modec != 'c' && modec != 'g')
|
if (modec != 't' && modec != 'c' && modec != 'g')
|
||||||
modec = 0; /* replace invalid with current */
|
modec = 0; /* replace invalid with current */
|
||||||
} else {
|
} else {
|
||||||
if (t_colors > 1)
|
if (abstract_ui || t_colors > 1)
|
||||||
modec = 'c';
|
modec = 'c';
|
||||||
else
|
else
|
||||||
modec = 't';
|
modec = 't';
|
||||||
|
@@ -281,9 +281,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
event_init();
|
event_init();
|
||||||
|
|
||||||
if (abstract_ui) {
|
if (!abstract_ui) {
|
||||||
t_colors = 256;
|
|
||||||
} else {
|
|
||||||
// Print a warning if stdout is not a terminal TODO(tarruda): Remove this
|
// Print a warning if stdout is not a terminal TODO(tarruda): Remove this
|
||||||
// check once the new terminal UI is implemented
|
// check once the new terminal UI is implemented
|
||||||
check_tty(¶ms);
|
check_tty(¶ms);
|
||||||
|
@@ -5971,7 +5971,7 @@ void screen_stop_highlight(void)
|
|||||||
*/
|
*/
|
||||||
void reset_cterm_colors(void)
|
void reset_cterm_colors(void)
|
||||||
{
|
{
|
||||||
if (t_colors > 1) {
|
if (abstract_ui || t_colors > 1) {
|
||||||
/* set Normal cterm colors */
|
/* set Normal cterm colors */
|
||||||
if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) {
|
if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) {
|
||||||
out_str(T_OP);
|
out_str(T_OP);
|
||||||
@@ -6150,8 +6150,7 @@ void screen_fill(int start_row, int end_row, int start_col, int end_col, int c1,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* it's a "normal" terminal when not in a GUI or cterm */
|
/* it's a "normal" terminal when not in a GUI or cterm */
|
||||||
norm_term = (
|
norm_term = (!abstract_ui && t_colors <= 1);
|
||||||
t_colors <= 1);
|
|
||||||
for (row = start_row; row < end_row; ++row) {
|
for (row = start_row; row < end_row; ++row) {
|
||||||
if (has_mbyte
|
if (has_mbyte
|
||||||
) {
|
) {
|
||||||
@@ -6675,7 +6674,7 @@ static void linecopy(int to, int from, win_T *wp)
|
|||||||
*/
|
*/
|
||||||
int can_clear(char_u *p)
|
int can_clear(char_u *p)
|
||||||
{
|
{
|
||||||
return *p != NUL && (t_colors <= 1
|
return *p != NUL && ((!abstract_ui && t_colors <= 1)
|
||||||
|| cterm_normal_bg_color == 0 || *T_UT != NUL);
|
|| cterm_normal_bg_color == 0 || *T_UT != NUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7702,8 +7701,7 @@ static void draw_tabline(void)
|
|||||||
int attr_fill = hl_attr(HLF_TPF);
|
int attr_fill = hl_attr(HLF_TPF);
|
||||||
char_u *p;
|
char_u *p;
|
||||||
int room;
|
int room;
|
||||||
int use_sep_chars = (t_colors < 8
|
int use_sep_chars = !abstract_ui && t_colors < 8;
|
||||||
);
|
|
||||||
|
|
||||||
redraw_tabline = FALSE;
|
redraw_tabline = FALSE;
|
||||||
|
|
||||||
|
@@ -5984,7 +5984,7 @@ init_highlight (
|
|||||||
* With 8 colors brown is equal to yellow, need to use black for Search fg
|
* With 8 colors brown is equal to yellow, need to use black for Search fg
|
||||||
* to avoid Statement highlighted text disappears.
|
* to avoid Statement highlighted text disappears.
|
||||||
* Clear the attributes, needed when changing the t_Co value. */
|
* Clear the attributes, needed when changing the t_Co value. */
|
||||||
if (t_colors > 8)
|
if (abstract_ui || t_colors > 8)
|
||||||
do_highlight(
|
do_highlight(
|
||||||
(char_u *)(*p_bg == 'l'
|
(char_u *)(*p_bg == 'l'
|
||||||
? "Visual cterm=NONE ctermbg=LightGrey"
|
? "Visual cterm=NONE ctermbg=LightGrey"
|
||||||
@@ -6449,7 +6449,7 @@ do_highlight (
|
|||||||
HL_TABLE()[idx].sg_cterm &= ~HL_BOLD;
|
HL_TABLE()[idx].sg_cterm &= ~HL_BOLD;
|
||||||
}
|
}
|
||||||
color &= 7; /* truncate to 8 colors */
|
color &= 7; /* truncate to 8 colors */
|
||||||
} else if (t_colors == 16 || t_colors == 88
|
} else if (abstract_ui || t_colors == 16 || t_colors == 88
|
||||||
|| t_colors == 256) {
|
|| t_colors == 256) {
|
||||||
/*
|
/*
|
||||||
* Guess: if the termcap entry ends in 'm', it is
|
* Guess: if the termcap entry ends in 'm', it is
|
||||||
@@ -6497,7 +6497,7 @@ do_highlight (
|
|||||||
if (color >= 0) {
|
if (color >= 0) {
|
||||||
if (termcap_active)
|
if (termcap_active)
|
||||||
term_bg_color(color);
|
term_bg_color(color);
|
||||||
if (t_colors < 16)
|
if (!abstract_ui && t_colors < 16)
|
||||||
i = (color == 0 || color == 4);
|
i = (color == 0 || color == 4);
|
||||||
else
|
else
|
||||||
i = (color < 7 || color == 8);
|
i = (color < 7 || color == 8);
|
||||||
@@ -6873,7 +6873,7 @@ int hl_combine_attr(int char_attr, int prim_attr)
|
|||||||
if (char_attr <= HL_ALL && prim_attr <= HL_ALL)
|
if (char_attr <= HL_ALL && prim_attr <= HL_ALL)
|
||||||
return char_attr | prim_attr;
|
return char_attr | prim_attr;
|
||||||
|
|
||||||
if (t_colors > 1) {
|
if (abstract_ui || t_colors > 1) {
|
||||||
if (char_attr > HL_ALL)
|
if (char_attr > HL_ALL)
|
||||||
char_aep = syn_cterm_attr2entry(char_attr);
|
char_aep = syn_cterm_attr2entry(char_attr);
|
||||||
if (char_aep != NULL)
|
if (char_aep != NULL)
|
||||||
@@ -6937,7 +6937,7 @@ int syn_attr2attr(int attr)
|
|||||||
{
|
{
|
||||||
attrentry_T *aep;
|
attrentry_T *aep;
|
||||||
|
|
||||||
if (t_colors > 1)
|
if (abstract_ui || t_colors > 1)
|
||||||
aep = syn_cterm_attr2entry(attr);
|
aep = syn_cterm_attr2entry(attr);
|
||||||
else
|
else
|
||||||
aep = syn_term_attr2entry(attr);
|
aep = syn_term_attr2entry(attr);
|
||||||
@@ -7364,7 +7364,7 @@ int syn_id2attr(int hl_id)
|
|||||||
hl_id = syn_get_final_id(hl_id);
|
hl_id = syn_get_final_id(hl_id);
|
||||||
sgp = &HL_TABLE()[hl_id - 1]; /* index is ID minus one */
|
sgp = &HL_TABLE()[hl_id - 1]; /* index is ID minus one */
|
||||||
|
|
||||||
if (t_colors > 1)
|
if (abstract_ui || t_colors > 1)
|
||||||
attr = sgp->sg_cterm_attr;
|
attr = sgp->sg_cterm_attr;
|
||||||
else
|
else
|
||||||
attr = sgp->sg_term_attr;
|
attr = sgp->sg_term_attr;
|
||||||
|
Reference in New Issue
Block a user