aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-12-12 16:29:25 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-01-10 21:41:32 -0300
commit748920d505e2997c79e08d87d09c564eaea23a2f (patch)
tree20a275d44c1723d387875330c0873f594c9aed15
parent68151636065f9f23ea40dca826964ffafa29c283 (diff)
downloadrneovim-748920d505e2997c79e08d87d09c564eaea23a2f.tar.gz
rneovim-748920d505e2997c79e08d87d09c564eaea23a2f.tar.bz2
rneovim-748920d505e2997c79e08d87d09c564eaea23a2f.zip
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.
-rw-r--r--src/nvim/edit.c3
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/main.c4
-rw-r--r--src/nvim/screen.c10
-rw-r--r--src/nvim/syntax.c12
5 files changed, 13 insertions, 18 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index e1a1fb18fa..89696410c9 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -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;
}
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 9974315d3f..913d6bf8c6 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -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';
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 1f6c8ddc81..5e9fde67f5 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -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);
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 855c09619e..614f138e31 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -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;
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 8f686ca59f..68589522c4 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -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;