{
char_u *color_name;
guicolor_T guicolor;
+ int called_emsg_before = called_emsg;
color_name = tv_get_string_chk(&li->li_tv);
if (color_name == NULL)
guicolor = GUI_GET_COLOR(color_name);
if (guicolor == INVALCOLOR)
+ {
+ if (called_emsg_before == called_emsg)
+ // may not get the error if the GUI didn't start
+ semsg(_(e_alloc_color), color_name);
return FAIL;
+ }
rgb[n] = GUI_MCH_GET_RGB(guicolor);
}
t = termgui_mch_get_color(name);
if (t == INVALCOLOR)
- semsg(_("E254: Cannot allocate color %s"), name);
+ semsg(_(e_alloc_color), name);
return t;
}
log_tr("Received t_Co, redraw_asap(): %d", r);
}
-#else
+# else
redraw_asap(CLEAR);
-#endif
+# endif
}
}
#endif
#ifdef HAVE_TGETENT
static char *(key_names[]) =
{
-#ifdef FEAT_TERMRESPONSE
+# ifdef FEAT_TERMRESPONSE
// Do this one first, it may cause a screen redraw.
"Co",
-#endif
+# endif
"ku", "kd", "kr", "kl",
"#2", "#4", "%i", "*7",
"k1", "k2", "k3", "k4", "k5", "k6",
call assert_fails(cmd, 'E475:')
let cmd = "call term_start('', {'term_highlight' : []})"
call assert_fails(cmd, 'E475:')
- if has('gui')
+ if has('gui') || has('termguicolors')
let cmd = "call term_start('', {'ansi_colors' : 'abc'})"
call assert_fails(cmd, 'E475:')
let cmd = "call term_start('', {'ansi_colors' : [[]]})"
call assert_fails(cmd, 'E730:')
let cmd = "call term_start('', {'ansi_colors' : repeat(['blue'], 18)})"
- call assert_fails(cmd, 'E475:')
+ if has('gui_running') || has('termguicolors')
+ call assert_fails(cmd, 'E475:')
+ else
+ call assert_fails(cmd, 'E254:')
+ endif
endif
endfunc
" Test for passing invalid arguments to terminal functions
func Test_term_func_invalid_arg()
call assert_fails('let b = term_getaltscreen([])', 'E745:')
- call assert_fails('let p = term_getansicolors([])', 'E745:')
call assert_fails('let a = term_getattr(1, [])', 'E730:')
call assert_fails('let c = term_getcursor([])', 'E745:')
call assert_fails('let l = term_getline([], 1)', 'E745:')
call assert_fails('let s = term_getstatus([])', 'E745:')
call assert_fails('let s = term_scrape([], 1)', 'E745:')
call assert_fails('call term_sendkeys([], "a")', 'E745:')
- call assert_fails('call term_setansicolors([], [])', 'E745:')
call assert_fails('call term_setapi([], "")', 'E745:')
call assert_fails('call term_setrestore([], "")', 'E745:')
call assert_fails('call term_setkill([], "")', 'E745:')
+ if has('gui') || has('termguicolors')
+ call assert_fails('let p = term_getansicolors([])', 'E745:')
+ call assert_fails('call term_setansicolors([], [])', 'E745:')
+ endif
endfunc
" Test for sending various special keycodes to a terminal