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:
Thiago de Arruda 2014-12-12 16:29:25 -03:00
parent 6815163606
commit 748920d505
5 changed files with 13 additions and 18 deletions

View File

@ -2294,8 +2294,7 @@ static int pum_wanted(void)
return FALSE;
/* The display looks bad on a B&W display. */
if (t_colors < 8
)
if (!abstract_ui && t_colors < 8)
return FALSE;
return TRUE;
}

View File

@ -14440,7 +14440,7 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv)
if (modec != 't' && modec != 'c' && modec != 'g')
modec = 0; /* replace invalid with current */
} else {
if (t_colors > 1)
if (abstract_ui || t_colors > 1)
modec = 'c';
else
modec = 't';

View File

@ -281,9 +281,7 @@ int main(int argc, char **argv)
event_init();
if (abstract_ui) {
t_colors = 256;
} else {
if (!abstract_ui) {
// Print a warning if stdout is not a terminal TODO(tarruda): Remove this
// check once the new terminal UI is implemented
check_tty(&params);

View File

@ -5971,7 +5971,7 @@ void screen_stop_highlight(void)
*/
void reset_cterm_colors(void)
{
if (t_colors > 1) {
if (abstract_ui || t_colors > 1) {
/* set Normal cterm colors */
if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) {
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;
/* it's a "normal" terminal when not in a GUI or cterm */
norm_term = (
t_colors <= 1);
norm_term = (!abstract_ui && t_colors <= 1);
for (row = start_row; row < end_row; ++row) {
if (has_mbyte
) {
@ -6675,7 +6674,7 @@ static void linecopy(int to, int from, win_T *wp)
*/
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);
}
@ -7702,8 +7701,7 @@ static void draw_tabline(void)
int attr_fill = hl_attr(HLF_TPF);
char_u *p;
int room;
int use_sep_chars = (t_colors < 8
);
int use_sep_chars = !abstract_ui && t_colors < 8;
redraw_tabline = FALSE;

View File

@ -5984,7 +5984,7 @@ init_highlight (
* With 8 colors brown is equal to yellow, need to use black for Search fg
* to avoid Statement highlighted text disappears.
* Clear the attributes, needed when changing the t_Co value. */
if (t_colors > 8)
if (abstract_ui || t_colors > 8)
do_highlight(
(char_u *)(*p_bg == 'l'
? "Visual cterm=NONE ctermbg=LightGrey"
@ -6449,7 +6449,7 @@ do_highlight (
HL_TABLE()[idx].sg_cterm &= ~HL_BOLD;
}
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) {
/*
* Guess: if the termcap entry ends in 'm', it is
@ -6497,7 +6497,7 @@ do_highlight (
if (color >= 0) {
if (termcap_active)
term_bg_color(color);
if (t_colors < 16)
if (!abstract_ui && t_colors < 16)
i = (color == 0 || color == 4);
else
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)
return char_attr | prim_attr;
if (t_colors > 1) {
if (abstract_ui || t_colors > 1) {
if (char_attr > HL_ALL)
char_aep = syn_cterm_attr2entry(char_attr);
if (char_aep != NULL)
@ -6937,7 +6937,7 @@ int syn_attr2attr(int attr)
{
attrentry_T *aep;
if (t_colors > 1)
if (abstract_ui || t_colors > 1)
aep = syn_cterm_attr2entry(attr);
else
aep = syn_term_attr2entry(attr);
@ -7364,7 +7364,7 @@ int syn_id2attr(int hl_id)
hl_id = syn_get_final_id(hl_id);
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;
else
attr = sgp->sg_term_attr;