diff --git a/src/Makefile b/src/Makefile index d90e5699bf..289648d570 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1076,6 +1076,9 @@ SYS_DELMENU_FILE = $(DESTDIR)$(SCRIPTLOC)/delmenu.vim ### Name of the bugreport file target. SYS_BUGR_FILE = $(DESTDIR)$(SCRIPTLOC)/bugreport.vim +### Name of the rgb.txt file target. +SYS_RGB_FILE = $(DESTDIR)$(SCRIPTLOC)/rgb.txt + ### Name of the file type detection file target. SYS_FILETYPE_FILE = $(DESTDIR)$(SCRIPTLOC)/filetype.vim @@ -2184,6 +2187,9 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ chmod $(VIMSCRIPTMOD) $(MSWIN_FILE) $(INSTALL_DATA) $(SCRIPTSOURCE)/evim.vim $(EVIM_FILE) chmod $(VIMSCRIPTMOD) $(EVIM_FILE) +# install the rgb.txt file + $(INSTALL_DATA) $(SCRIPTSOURCE)/rgb.txt $(SYS_RGB_FILE) + chmod $(VIMSCRIPTMOD) $(SYS_RGB_FILE) # install the bugreport file $(INSTALL_DATA) $(SCRIPTSOURCE)/bugreport.vim $(SYS_BUGR_FILE) chmod $(VIMSCRIPTMOD) $(SYS_BUGR_FILE) @@ -2380,7 +2386,7 @@ install-icons: if test -d $(ICON48PATH) -a -w $(ICON48PATH) \ -a ! -f $(ICON48PATH)/gvim.png; then \ $(INSTALL_DATA) $(SCRIPTSOURCE)/vim48x48.png $(ICON48PATH)/gvim.png; \ - if test -z "$(DESTDIR)" -a -x $(GTK_UPDATE_ICON_CACHE) \ + if test -z "$(DESTDIR)" -a -x "$(GTK_UPDATE_ICON_CACHE)" \ -a -w $(ICONTHEMEPATH) \ -a -f $(ICONTHEMEPATH)/index.theme; then \ $(GTK_UPDATE_ICON_CACHE) -q $(ICONTHEMEPATH); \ @@ -2398,7 +2404,7 @@ install-icons: $(INSTALL_DATA) $(SCRIPTSOURCE)/vim.desktop \ $(SCRIPTSOURCE)/gvim.desktop \ $(DESKTOPPATH); \ - if test -z "$(DESTDIR)" -a -x $(UPDATE_DESKTOP_DATABASE); then \ + if test -z "$(DESTDIR)" -a -x "$(UPDATE_DESKTOP_DATABASE)"; then \ $(UPDATE_DESKTOP_DATABASE) -q $(DESKTOPPATH); \ fi \ fi diff --git a/src/eval.c b/src/eval.c index 2e4d90f64a..c7b094ae5a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -98,7 +98,9 @@ static char *e_listarg = N_("E686: Argument of %s must be a List"); static char *e_listdictarg = N_("E712: Argument of %s must be a List or Dictionary"); static char *e_listreq = N_("E714: List required"); static char *e_dictreq = N_("E715: Dictionary required"); +#ifdef FEAT_QUICKFIX static char *e_stringreq = N_("E928: String required"); +#endif static char *e_toomanyarg = N_("E118: Too many arguments for function: %s"); static char *e_dictkey = N_("E716: Key not present in Dictionary: %s"); static char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it"); @@ -10406,6 +10408,8 @@ f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) f_ch_open(typval_T *argvars, typval_T *rettv) { rettv->v_type = VAR_CHANNEL; + if (check_restricted() || check_secure()) + return; rettv->vval.v_channel = channel_open_func(argvars); } @@ -15095,6 +15099,8 @@ f_job_setoptions(typval_T *argvars, typval_T *rettv UNUSED) f_job_start(typval_T *argvars, typval_T *rettv) { rettv->v_type = VAR_JOB; + if (check_restricted() || check_secure()) + return; rettv->vval.v_job = job_start(argvars); } @@ -16838,8 +16844,6 @@ check_connection(void) #endif #ifdef FEAT_CLIENTSERVER -static void remote_common(typval_T *argvars, typval_T *rettv, int expr); - static void remote_common(typval_T *argvars, typval_T *rettv, int expr) { @@ -20708,6 +20712,8 @@ f_timer_start(typval_T *argvars, typval_T *rettv) char_u *callback; dict_T *dict; + if (check_secure()) + return; if (argvars[2].v_type != VAR_UNKNOWN) { if (argvars[2].v_type != VAR_DICT diff --git a/src/screen.c b/src/screen.c index 88ed4e0c48..bc21848761 100644 --- a/src/screen.c +++ b/src/screen.c @@ -7855,7 +7855,7 @@ screen_start_highlight(int attr) else if (aep != NULL && cterm_normal_fg_bold && #ifdef FEAT_TERMTRUECOLOR (p_guicolors ? - (aep->ae_u.cterm.fg_rgb != INVALCOLOR): + (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR): #endif (t_colors > 1 && aep->ae_u.cterm.fg_color) #ifdef FEAT_TERMTRUECOLOR @@ -7884,9 +7884,9 @@ screen_start_highlight(int attr) #ifdef FEAT_TERMTRUECOLOR if (p_guicolors) { - if (aep->ae_u.cterm.fg_rgb != INVALCOLOR) + if (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR) term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); - if (aep->ae_u.cterm.bg_rgb != INVALCOLOR) + if (aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR) term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); } else @@ -7946,8 +7946,8 @@ screen_stop_highlight(void) if (aep != NULL && #ifdef FEAT_TERMTRUECOLOR (p_guicolors ? - (aep->ae_u.cterm.fg_rgb != INVALCOLOR || - aep->ae_u.cterm.bg_rgb != INVALCOLOR): + (aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR || + aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR): #endif (aep->ae_u.cterm.fg_color || aep->ae_u.cterm.bg_color) #ifdef FEAT_TERMTRUECOLOR @@ -8004,9 +8004,9 @@ screen_stop_highlight(void) #ifdef FEAT_TERMTRUECOLOR if (p_guicolors) { - if (cterm_normal_fg_gui_color != INVALCOLOR) + if (cterm_normal_fg_gui_color != (long_u)INVALCOLOR) term_fg_rgb_color(cterm_normal_fg_gui_color); - if (cterm_normal_bg_gui_color != INVALCOLOR) + if (cterm_normal_bg_gui_color != (long_u)INVALCOLOR) term_bg_rgb_color(cterm_normal_bg_gui_color); } else @@ -8040,8 +8040,8 @@ reset_cterm_colors(void) /* set Normal cterm colors */ #ifdef FEAT_TERMTRUECOLOR if (p_guicolors ? - (cterm_normal_fg_gui_color != INVALCOLOR - || cterm_normal_bg_gui_color != INVALCOLOR): + (cterm_normal_fg_gui_color != (long_u)INVALCOLOR + || cterm_normal_bg_gui_color != (long_u)INVALCOLOR): (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)) #else if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) @@ -8988,7 +8988,7 @@ can_clear(char_u *p) || gui.in_use #endif #ifdef FEAT_TERMTRUECOLOR - || (p_guicolors && cterm_normal_bg_gui_color != INVALCOLOR) + || (p_guicolors && cterm_normal_bg_gui_color != (long_u)INVALCOLOR) #endif || cterm_normal_bg_color == 0 || *T_UT != NUL)); } diff --git a/src/syntax.c b/src/syntax.c index dc04681320..70d78b597d 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -8789,9 +8789,9 @@ hl_combine_attr(int char_attr, int prim_attr) if (spell_aep->ae_u.cterm.bg_color > 0) new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; #ifdef FEAT_TERMTRUECOLOR - if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR) + if (spell_aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR) new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; - if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR) + if (spell_aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR) new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; #endif } @@ -9546,8 +9546,8 @@ highlight_gui_started(void) static void gui_do_one_color( int idx, - int do_menu, /* TRUE: might set the menu font */ - int do_tooltip) /* TRUE: might set the tooltip font */ + int do_menu UNUSED, /* TRUE: might set the menu font */ + int do_tooltip UNUSED) /* TRUE: might set the tooltip font */ { int didit = FALSE; diff --git a/src/term.c b/src/term.c index 82f8012b07..34549b152a 100644 --- a/src/term.c +++ b/src/term.c @@ -793,10 +793,8 @@ static struct builtin_term builtin_termcaps[] = # endif # endif -# if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) || defined(FEAT_TERMTRUECOLOR) - {(int)KS_NAME, "xterm"}, -# endif # if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) || defined(SOME_BUILTIN_TCAPS) || defined(__EMX__) + {(int)KS_NAME, "xterm"}, {(int)KS_CE, IF_EB("\033[K", ESC_STR "[K")}, {(int)KS_AL, IF_EB("\033[L", ESC_STR "[L")}, # ifdef TERMINFO @@ -861,6 +859,11 @@ static struct builtin_term builtin_termcaps[] = {(int)KS_CRV, IF_EB("\033[>c", ESC_STR "[>c")}, {(int)KS_RBG, IF_EB("\033]11;?\007", ESC_STR "]11;?\007")}, {(int)KS_U7, IF_EB("\033[6n", ESC_STR "[6n")}, +# ifdef FEAT_TERMTRUECOLOR + /* These are printf strings, not terminal codes. */ + {(int)KS_8F, IF_EB("\033[38;2;%lu;%lu;%lum", ESC_STR "[38;2;%lu;%lu;%lum")}, + {(int)KS_8B, IF_EB("\033[48;2;%lu;%lu;%lum", ESC_STR "[48;2;%lu;%lu;%lum")}, +# endif {K_UP, IF_EB("\033O*A", ESC_STR "O*A")}, {K_DOWN, IF_EB("\033O*B", ESC_STR "O*B")}, @@ -944,10 +947,6 @@ static struct builtin_term builtin_termcaps[] = {TERMCAP2KEY('F', 'Q'), IF_EB("\033[57;*~", ESC_STR "[57;*~")}, /* F36 */ {TERMCAP2KEY('F', 'R'), IF_EB("\033[58;*~", ESC_STR "[58;*~")}, /* F37 */ # endif -# ifdef FEAT_TERMTRUECOLOR - {(int)KS_8F, IF_EB("\033[38;2;%lu;%lu;%lum", ESC_STR "[38;2;%lu;%lu;%lum")}, - {(int)KS_8B, IF_EB("\033[48;2;%lu;%lu;%lum", ESC_STR "[48;2;%lu;%lu;%lum")}, -# endif # if defined(UNIX) || defined(ALL_BUILTIN_TCAPS) /* @@ -1272,6 +1271,7 @@ struct rgbcolor_table_S { char_u *color_name; guicolor_T color; }; + static struct rgbcolor_table_S rgb_table[] = { {(char_u *)"black", RGB(0x00, 0x00, 0x00)}, {(char_u *)"blue", RGB(0x00, 0x00, 0xD4)}, @@ -1354,7 +1354,7 @@ termtrue_mch_get_color(char_u *name) else { /* Check if the name is one of the colors we know */ - for (i = 0; i < sizeof(rgb_table) / sizeof(rgb_table[0]); i++) + for (i = 0; i < (int)(sizeof(rgb_table) / sizeof(rgb_table[0])); i++) if (STRICMP(name, rgb_table[i].color_name) == 0) return rgb_table[i].color; } @@ -1382,9 +1382,8 @@ termtrue_mch_get_color(char_u *name) { int len; int pos; - char *color; - fgets(line, LINE_LEN, fd); + (void)fgets(line, LINE_LEN, fd); len = strlen(line); if (len <= 1 || line[len-1] != '\n') @@ -1396,9 +1395,7 @@ termtrue_mch_get_color(char_u *name) if (i != 3) continue; - color = line + pos; - - if (STRICMP(color, name) == 0) + if (STRICMP(line + pos, name) == 0) { fclose(fd); return (guicolor_T) RGB(r, g, b); @@ -2803,9 +2800,11 @@ term_bg_rgb_color(long_u rgb) static void term_rgb_color(char_u *s, long_u rgb) { - char buf[7+3*3+2+1+1]; +#define MAX_COLOR_STR_LEN 100 + char buf[MAX_COLOR_STR_LEN]; - sprintf(buf, (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb)); + vim_snprintf(buf, MAX_COLOR_STR_LEN, + (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb)); OUT_STR(buf); } #endif diff --git a/src/version.c b/src/version.c index a69db00b35..0bf072d2d0 100644 --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,22 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1778, +/**/ + 1777, +/**/ + 1776, +/**/ + 1775, +/**/ + 1774, +/**/ + 1773, +/**/ + 1772, +/**/ + 1771, /**/ 1770, /**/