aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/CMakeLists.txt1
-rw-r--r--src/nvim/api/vim.c12
-rw-r--r--src/nvim/ex_docmd.c28
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/globals.h11
-rw-r--r--src/nvim/if_cscope.c7
-rw-r--r--src/nvim/main.c139
-rw-r--r--src/nvim/msgpack_rpc/helpers.c6
-rw-r--r--src/nvim/normal.c1
-rw-r--r--src/nvim/option.c7
-rw-r--r--src/nvim/option_defs.h1
-rw-r--r--src/nvim/os_unix.c29
-rw-r--r--src/nvim/screen.c8
-rw-r--r--src/nvim/syntax.c348
-rw-r--r--src/nvim/syntax.h6
-rw-r--r--src/nvim/version.c22
16 files changed, 311 insertions, 317 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index d78bd5f711..6fc5022d48 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -82,7 +82,6 @@ set(CONV_SOURCES
syntax.c
tag.c
ui.c
- version.c
window.c)
foreach(sfile ${CONV_SOURCES})
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 45cc3c530b..b7b2f7630c 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -552,6 +552,18 @@ Integer vim_name_to_color(String name)
return name_to_color((uint8_t *)name.data);
}
+Dictionary vim_get_color_map(void)
+{
+ Dictionary colors = ARRAY_DICT_INIT;
+
+ for (int i = 0; color_name_table[i].name != NULL; i++) {
+ PUT(colors, color_name_table[i].name,
+ INTEGER_OBJ(color_name_table[i].color));
+ }
+ return colors;
+}
+
+
Array vim_get_api_info(uint64_t channel_id)
{
Array rv = ARRAY_DICT_INIT;
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index f6527db69b..9b48398d96 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3219,27 +3219,15 @@ get_address (
}
if (!skip) {
- /*
- * When search follows another address, start from
- * there.
- */
- if (lnum != MAXLNUM)
- pos.lnum = lnum;
- else
- pos.lnum = curwin->w_cursor.lnum;
-
- /*
- * Start the search just like for the above
- * do_search().
- */
- if (*cmd != '?')
- pos.col = MAXCOL;
- else
- pos.col = 0;
+ // When search follows another address, start from there.
+ pos.lnum = (lnum != MAXLNUM) ? lnum : curwin->w_cursor.lnum;
+ // Start the search just like for the above do_search().
+ pos.col = (*cmd != '?') ? MAXCOL : 0;
+ pos.coladd = 0;
if (searchit(curwin, curbuf, &pos,
- *cmd == '?' ? BACKWARD : FORWARD,
- (char_u *)"", 1L, SEARCH_MSG,
- i, (linenr_T)0, NULL) != FAIL)
+ *cmd == '?' ? BACKWARD : FORWARD,
+ (char_u *)"", 1L, SEARCH_MSG,
+ i, (linenr_T)0, NULL) != FAIL)
lnum = pos.lnum;
else {
cmd = NULL;
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 863e44ed9c..2667d13b78 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -6828,7 +6828,7 @@ void unblock_autocmds(void)
/* When v:termresponse was set while autocommands were blocked, trigger
* the autocommands now. Esp. useful when executing a shell command
- * during startup (vimdiff). */
+ * during startup (nvim -d). */
if (autocmd_blocked == 0
&& get_vim_var_str(VV_TERMRESPONSE) != old_termresponse)
apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf);
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 73bcdea226..1aa90777fa 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -405,7 +405,8 @@ EXTERN int no_check_timestamps INIT(= 0); /* Don't check timestamps */
typedef enum {
HLF_8 = 0 /* Meta & special keys listed with ":map", text that is
displayed different from what it is */
- , HLF_AT /* @ and ~ characters at end of screen, characters that
+ , HLF_EOB // after the last line in the buffer
+ , HLF_AT /* @ characters at end of screen, characters that
don't really exist in the text */
, HLF_D /* directories in CTRL-D listing */
, HLF_E /* error messages */
@@ -451,10 +452,10 @@ typedef enum {
/* The HL_FLAGS must be in the same order as the HLF_ enums!
* When changing this also adjust the default for 'highlight'. */
-#define HL_FLAGS {'8', '@', 'd', 'e', 'i', 'l', 'm', 'M', 'n', 'N', 'r', 's', \
- 'S', 'c', 't', 'v', 'V', 'w', 'W', 'f', 'F', 'A', 'C', 'D', \
- 'T', '-', '>', 'B', 'P', 'R', 'L', '+', '=', 'x', 'X', '*', \
- '#', '_', '!', '.', 'o'}
+#define HL_FLAGS {'8', '~', '@', 'd', 'e', 'i', 'l', 'm', 'M', 'n', 'N', 'r', \
+ 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', 'f', 'F', 'A', 'C', \
+ 'D', 'T', '-', '>', 'B', 'P', 'R', 'L', '+', '=', 'x', 'X', \
+ '*', '#', '_', '!', '.', 'o'}
EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */
# define USER_HIGHLIGHT
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index 843cbcf6f9..09f4ecf519 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -1646,7 +1646,6 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
char *fname, *lno, *extra, *tbuf;
int i, idx, num;
char *globalcntx = "GLOBAL";
- char *cntxformat = " <<%s>>";
char *context;
char *cstag_msg = _("Cscope tag: %s");
@@ -1706,7 +1705,11 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
context = cntxts[idx];
else
context = globalcntx;
- newsize = strlen(context) + strlen(cntxformat);
+
+ const char *cntxformat = " <<%s>>";
+ // '%s' won't appear in result string, so:
+ // newsize = len(cntxformat) - 2 + len(context) + 1 (for NUL).
+ newsize = strlen(context) + strlen(cntxformat) - 1;
if (bufsize < newsize) {
buf = xrealloc(buf, newsize);
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 083da9bee9..6e24806c56 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -204,7 +204,7 @@ int main(int argc, char **argv)
/*
* Figure out the way to work from the command name argv[0].
- * "vimdiff" starts diff mode, "rvim" sets "restricted", etc.
+ * "view" sets "readonlymode", "rvim" sets "restricted", etc.
*/
parse_command_name(&params);
@@ -454,7 +454,7 @@ int main(int argc, char **argv)
edit_buffers(&params);
if (params.diff_mode) {
- /* set options in each window for "vimdiff". */
+ /* set options in each window for "nvim -d". */
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
diff_win_options(wp, TRUE);
}
@@ -867,11 +867,10 @@ static void init_locale(void)
#endif
/*
- * Check for: [r][g][vi|vim|view][diff][ex[im]]
+ * Check for: [r][g][vi|vim|view][ex[im]]
* If the executable name starts with "r" we disable shell commands.
* If the next character is "g" we run the GUI version.
* If the next characters are "view" we start in readonly mode.
- * If the next characters are "diff" or "vimdiff" we start in diff mode.
* If the next characters are "ex" we start in Ex mode. If it's followed
* by "im" use improved Ex mode.
*/
@@ -902,10 +901,6 @@ static void parse_command_name(mparm_T *parmp)
parse_string(&initstr, "vim", 3); /* consume "vim" if it's there */
}
- /* Catch "[r][g]vimdiff" and "[r][g]viewdiff". */
- if (parse_string(&initstr, "diff", 4))
- parmp->diff_mode = TRUE;
-
if (parse_string(&initstr, "ex", 2)) {
if (parse_string(&initstr, "im", 2))
exmode_active = EXMODE_VIM;
@@ -2057,93 +2052,65 @@ static void mainerr(int n, const char *str)
}
-/*
- * print a message with three spaces prepended and '\n' appended.
- */
-static void main_msg(char *s)
-{
- mch_msg(" ");
- mch_msg(s);
- mch_msg("\n");
-}
-
-/*
- * Print messages for "vim -h" or "vim --help" and exit.
- */
+/// Prints help message and exits; used for 'nvim -h' & 'nvim --help'
static void usage(void)
{
- int i;
- static char *(use[]) =
- {
- N_("[file ..] edit specified file(s)"),
- N_("- read text from stdin"),
- N_("-t tag edit file where tag is defined"),
- N_("-q [errorfile] edit file with first error")
- };
-
- signal_stop(); /* kill us with CTRL-C here, if you like */
-
- mch_msg(longVersion);
- mch_msg(_("\n\nusage:"));
- for (i = 0;; ++i) {
- mch_msg(_(" vim [arguments] "));
- mch_msg(_(use[i]));
- if (i == ARRAY_SIZE(use) - 1)
- break;
- mch_msg(_("\n or:"));
- }
+ signal_stop(); // kill us with CTRL-C here, if you like
- mch_msg(_("\n\nArguments:\n"));
- main_msg(_("--\t\t\tOnly file names after this"));
+ mch_msg(_("Usage:\n"));
+ mch_msg(_(" nvim [arguments] [file ...] Edit specified file(s)\n"));
+ mch_msg(_(" nvim [arguments] - Read text from stdin\n"));
+ mch_msg(_(" nvim [arguments] -t <tag> Edit file where tag is defined\n"));
+ mch_msg(_(" nvim [arguments] -q [errorfile] Edit file with first error\n"));
+ mch_msg(_("\nArguments:\n"));
+ mch_msg(_(" -- Only file names after this\n"));
#if !defined(UNIX)
- main_msg(_("--literal\t\tDon't expand wildcards"));
+ mch_msg(_(" --literal Don't expand wildcards\n"));
#endif
- main_msg(_("-v\t\t\tVi mode (like \"vi\")"));
- main_msg(_("-e\t\t\tEx mode (like \"ex\")"));
- main_msg(_("-E\t\t\tImproved Ex mode"));
- main_msg(_("-s\t\t\tSilent (batch) mode (only for \"ex\")"));
- main_msg(_("-d\t\t\tDiff mode (like \"vimdiff\")"));
- main_msg(_("-R\t\t\tReadonly mode (like \"view\")"));
- main_msg(_("-Z\t\t\tRestricted mode (like \"rvim\")"));
- main_msg(_("-m\t\t\tModifications (writing files) not allowed"));
- main_msg(_("-M\t\t\tModifications in text not allowed"));
- main_msg(_("-b\t\t\tBinary mode"));
- main_msg(_("-l\t\t\tLisp mode"));
- main_msg(_("-V[N][fname]\t\tBe verbose [level N] [log messages to fname]"));
- main_msg(_("-D\t\t\tDebugging mode"));
- main_msg(_("-n\t\t\tNo swap file, use memory only"));
- main_msg(_("-r\t\t\tList swap files and exit"));
- main_msg(_("-r (with file name)\tRecover crashed session"));
- main_msg(_("-L\t\t\tSame as -r"));
- main_msg(_("-A\t\t\tstart in Arabic mode"));
- main_msg(_("-H\t\t\tStart in Hebrew mode"));
- main_msg(_("-F\t\t\tStart in Farsi mode"));
- main_msg(_("-T <terminal>\tSet terminal type to <terminal>"));
- main_msg(_("-u <vimrc>\t\tUse <vimrc> instead of any .vimrc"));
- main_msg(_("--noplugin\t\tDon't load plugin scripts"));
- main_msg(_("-p[N]\t\tOpen N tab pages (default: one for each file)"));
- main_msg(_("-o[N]\t\tOpen N windows (default: one for each file)"));
- main_msg(_("-O[N]\t\tLike -o but split vertically"));
- main_msg(_("+\t\t\tStart at end of file"));
- main_msg(_("+<lnum>\t\tStart at line <lnum>"));
- main_msg(_("--cmd <command>\tExecute <command> before loading any vimrc file"));
- main_msg(_("-c <command>\t\tExecute <command> after loading the first file"));
- main_msg(_(
- "-S <session>\t\tSource file <session> after loading the first file"));
- main_msg(_("-s <scriptin>\tRead Normal mode commands from file <scriptin>"));
- main_msg(_("-w <scriptout>\tAppend all typed commands to file <scriptout>"));
- main_msg(_("-W <scriptout>\tWrite all typed commands to file <scriptout>"));
- main_msg(_("--startuptime <file>\tWrite startup timing messages to <file>"));
- main_msg(_("-i <viminfo>\t\tUse <viminfo> instead of .viminfo"));
- main_msg(_("--api-info\t\tDump API metadata serialized to msgpack and exit"));
- main_msg(_("--embed\t\tUse stdin/stdout as a msgpack-rpc channel. "
- "This can be used for embedding Neovim into other programs"));
- main_msg(_("-h or --help\tPrint Help (this message) and exit"));
- main_msg(_("--version\t\tPrint version information and exit"));
+ mch_msg(_(" -v Vi mode (like \"vi\")\n"));
+ mch_msg(_(" -e Ex mode (like \"ex\")\n"));
+ mch_msg(_(" -E Improved Ex mode\n"));
+ mch_msg(_(" -s Silent (batch) mode (only for \"ex\")\n"));
+ mch_msg(_(" -d Diff mode\n"));
+ mch_msg(_(" -R Readonly mode (like \"view\")\n"));
+ mch_msg(_(" -Z Restricted mode (like \"rvim\")\n"));
+ mch_msg(_(" -m Modifications (writing files) not allowed\n"));
+ mch_msg(_(" -M Modifications in text not allowed\n"));
+ mch_msg(_(" -b Binary mode\n"));
+ mch_msg(_(" -l Lisp mode\n"));
+ mch_msg(_(" -V[N][file] Be verbose [level N][log messages to file]\n"));
+ mch_msg(_(" -D Debugging mode\n"));
+ mch_msg(_(" -n No swap file, use memory only\n"));
+ mch_msg(_(" -r List swap files and exit\n"));
+ mch_msg(_(" -r <file> Recover crashed session\n"));
+ mch_msg(_(" -A Start in Arabic mode\n"));
+ mch_msg(_(" -F Start in Farsi mode\n"));
+ mch_msg(_(" -H Start in Hebrew mode\n"));
+ mch_msg(_(" -T <terminal> Set terminal type to <terminal>\n"));
+ mch_msg(_(" -u <nvimrc> Use <nvimrc> instead of any .nvimrc\n"));
+ mch_msg(_(" --noplugin Don't load plugin scripts\n"));
+ mch_msg(_(" -p[N] Open N tab pages (default: one for each file)\n"));
+ mch_msg(_(" -o[N] Open N windows (default: one for each file)\n"));
+ mch_msg(_(" -O[N] Like -o but split vertically\n"));
+ mch_msg(_(" + Start at end of file\n"));
+ mch_msg(_(" +<lnum> Start at line <lnum>\n"));
+ mch_msg(_(" --cmd <command> Execute <command> before loading any nvimrc\n"));
+ mch_msg(_(" -c <command> Execute <command> after loading the first file\n"));
+ mch_msg(_(" -S <session> Source file <session> after loading the first file\n"));
+ mch_msg(_(" -s <scriptin> Read Normal mode commands from file <scriptin>\n"));
+ mch_msg(_(" -w <scriptout> Append all typed commands to file <scriptout>\n"));
+ mch_msg(_(" -W <scriptout> Write all typed commands to file <scriptout>\n"));
+ mch_msg(_(" --startuptime <file> Write startup timing messages to <file>\n"));
+ mch_msg(_(" -i <nviminfo> Use <nviminfo> instead of .nviminfo\n"));
+ mch_msg(_(" --api-info Dump API metadata serialized to msgpack and exit\n"));
+ mch_msg(_(" --embed Use stdin/stdout as a msgpack-rpc channel\n"));
+ mch_msg(_(" --version Print version information and exit\n"));
+ mch_msg(_(" -h | --help Print this help message and exit\n"));
mch_exit(0);
}
+
/*
* Check the result of the ATTENTION dialog:
* When "Quit" selected, exit Vim.
diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c
index a702d4f256..54e8b83cd0 100644
--- a/src/nvim/msgpack_rpc/helpers.c
+++ b/src/nvim/msgpack_rpc/helpers.c
@@ -86,8 +86,8 @@ bool msgpack_rpc_to_integer(msgpack_object *obj, Integer *arg)
bool msgpack_rpc_to_float(msgpack_object *obj, Float *arg)
FUNC_ATTR_NONNULL_ALL
{
- *arg = obj->via.dec;
- return obj->type == MSGPACK_OBJECT_DOUBLE;
+ *arg = obj->via.f64;
+ return obj->type == MSGPACK_OBJECT_FLOAT;
}
bool msgpack_rpc_to_string(msgpack_object *obj, String *arg)
@@ -120,7 +120,7 @@ bool msgpack_rpc_to_object(msgpack_object *obj, Object *arg)
arg->type = kObjectTypeInteger;
return msgpack_rpc_to_integer(obj, &arg->data.integer);
- case MSGPACK_OBJECT_DOUBLE:
+ case MSGPACK_OBJECT_FLOAT:
arg->type = kObjectTypeFloat;
return msgpack_rpc_to_float(obj, &arg->data.floating);
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index f140922082..e147280723 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -834,6 +834,7 @@ getcount:
ca.cmdchar = Ctrl_BSL;
ca.nchar = c;
idx = find_command(ca.cmdchar);
+ assert(idx >= 0);
}
}
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 0199c5fc6c..182834c4f3 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -365,8 +365,8 @@ typedef struct vimoption {
# define ISP_LATIN1 (char_u *)"@,161-255"
#define HIGHLIGHT_INIT \
- "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search," \
- "m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine," \
+ "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch," \
+ "l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine," \
"S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg," \
"W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete," \
"T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare," \
@@ -1583,9 +1583,6 @@ static vimoption_T
{"ttybuiltin", "tbi", P_BOOL|P_VI_DEF,
(char_u *)&p_tbi, PV_NONE,
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
- {"ttyfast", "tf", P_BOOL|P_NO_MKRC|P_VI_DEF,
- (char_u *)&p_tf, PV_NONE,
- {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
{"ttymouse", "ttym", P_STRING|P_NODEFAULT|P_NO_MKRC|P_VI_DEF,
#if defined(FEAT_MOUSE) && defined(UNIX)
(char_u *)&p_ttym, PV_NONE,
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 99e8e645b6..c8b63cd155 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -569,7 +569,6 @@ EXTERN char_u *p_tsr; /* 'thesaurus' */
EXTERN int p_ttimeout; /* 'ttimeout' */
EXTERN long p_ttm; /* 'ttimeoutlen' */
EXTERN int p_tbi; /* 'ttybuiltin' */
-EXTERN int p_tf; /* 'ttyfast' */
EXTERN long p_ttyscroll; /* 'ttyscroll' */
#if defined(FEAT_MOUSE) && defined(UNIX)
EXTERN char_u *p_ttym; /* 'ttymouse' */
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c
index f7b47f9569..d674db951f 100644
--- a/src/nvim/os_unix.c
+++ b/src/nvim/os_unix.c
@@ -13,6 +13,7 @@
* changed beyond recognition.
*/
+#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -1158,14 +1159,30 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
free(tempname);
goto notfound;
}
- fseek(fd, 0L, SEEK_END);
- len = ftell(fd); /* get size of temp file */
+ int fseek_res = fseek(fd, 0L, SEEK_END);
+ if (fseek_res < 0) {
+ free(tempname);
+ fclose(fd);
+ return FAIL;
+ }
+ long long templen = ftell(fd); /* get size of temp file */
+ if (templen < 0) {
+ free(tempname);
+ fclose(fd);
+ return FAIL;
+ }
+#if SIZEOF_LONG_LONG > SIZEOF_SIZE_T
+ assert(templen <= (long long)SIZE_MAX);
+#endif
+ len = (size_t)templen;
fseek(fd, 0L, SEEK_SET);
buffer = xmalloc(len + 1);
- i = fread((char *)buffer, 1, len, fd);
+ // fread() doesn't terminate buffer with NUL;
+ // appropiate termination (not always NUL) is done below.
+ size_t readlen = fread((char *)buffer, 1, len, fd);
fclose(fd);
os_remove((char *)tempname);
- if (i != (int)len) {
+ if (readlen != len) {
/* unexpected read error */
EMSG2(_(e_notread), tempname);
free(tempname);
@@ -1174,8 +1191,6 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
}
free(tempname);
-
-
/* file names are separated with Space */
if (shell_style == STYLE_ECHO) {
buffer[len] = '\n'; /* make sure the buffer ends in NL */
@@ -1235,6 +1250,8 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
if (len)
++i; /* count last entry */
}
+ assert(buffer[len] == NUL || buffer[len] == '\n');
+
if (i == 0) {
/*
* Can happen when using /bin/sh and typing ":e $NO_SUCH_VAR^I".
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 6d25c4359b..7e7a7c1148 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1651,7 +1651,7 @@ static void win_update(win_T *wp)
/* make sure the rest of the screen is blank */
/* put '~'s on rows that aren't part of the file. */
- win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_AT);
+ win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_EOB);
}
/* Reset the type of redrawing required, the window has been updated. */
@@ -4196,8 +4196,7 @@ win_line (
* Don't do this for double-width characters.
* Don't do this for a window not at the right screen border.
*/
- if (p_tf
- && !(has_mbyte
+ if (!(has_mbyte
&& ((*mb_off2cells)(LineOffset[screen_row],
LineOffset[screen_row] + screen_Columns)
== 2
@@ -7102,8 +7101,9 @@ static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int de
return retval;
}
- if (wp->w_next != NULL && p_tf) /* don't delete/insert on fast terminal */
+ if (wp->w_next != NULL) {
return FAIL;
+ }
return MAYBE;
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index f24b2aa80a..c88088f25f 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5781,6 +5781,7 @@ static char *(highlight_init_both[]) =
"StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"),
CENT("StatusLineNC term=reverse cterm=reverse",
"StatusLineNC term=reverse cterm=reverse gui=reverse"),
+ "default link EndOfBuffer NonText",
CENT("VertSplit term=reverse cterm=reverse",
"VertSplit term=reverse cterm=reverse gui=reverse"),
CENT("DiffText term=reverse cterm=bold ctermbg=Red",
@@ -7644,184 +7645,181 @@ char_u *get_highlight_name(expand_T *xp, int idx)
return HL_TABLE()[idx].sg_name;
}
+#define RGB(r, g, b) ((r << 16) | (g << 8) | b)
+color_name_table_T color_name_table[] = {
+ // Color names taken from
+ // http://www.rapidtables.com/web/color/RGB_Color.htm
+ {"Maroon", RGB(0x80, 0x00, 0x00)},
+ {"DarkRed", RGB(0x8b, 0x00, 0x00)},
+ {"Brown", RGB(0xa5, 0x2a, 0x2a)},
+ {"Firebrick", RGB(0xb2, 0x22, 0x22)},
+ {"Crimson", RGB(0xdc, 0x14, 0x3c)},
+ {"Red", RGB(0xff, 0x00, 0x00)},
+ {"Tomato", RGB(0xff, 0x63, 0x47)},
+ {"Coral", RGB(0xff, 0x7f, 0x50)},
+ {"IndianRed", RGB(0xcd, 0x5c, 0x5c)},
+ {"LightCoral", RGB(0xf0, 0x80, 0x80)},
+ {"DarkSalmon", RGB(0xe9, 0x96, 0x7a)},
+ {"Salmon", RGB(0xfa, 0x80, 0x72)},
+ {"LightSalmon", RGB(0xff, 0xa0, 0x7a)},
+ {"OrangeRed", RGB(0xff, 0x45, 0x00)},
+ {"DarkOrange", RGB(0xff, 0x8c, 0x00)},
+ {"Orange", RGB(0xff, 0xa5, 0x00)},
+ {"Gold", RGB(0xff, 0xd7, 0x00)},
+ {"DarkGoldenRod", RGB(0xb8, 0x86, 0x0b)},
+ {"GoldenRod", RGB(0xda, 0xa5, 0x20)},
+ {"PaleGoldenRod", RGB(0xee, 0xe8, 0xaa)},
+ {"DarkKhaki", RGB(0xbd, 0xb7, 0x6b)},
+ {"Khaki", RGB(0xf0, 0xe6, 0x8c)},
+ {"Olive", RGB(0x80, 0x80, 0x00)},
+ {"Yellow", RGB(0xff, 0xff, 0x00)},
+ {"YellowGreen", RGB(0x9a, 0xcd, 0x32)},
+ {"DarkOliveGreen", RGB(0x55, 0x6b, 0x2f)},
+ {"OliveDrab", RGB(0x6b, 0x8e, 0x23)},
+ {"LawnGreen", RGB(0x7c, 0xfc, 0x00)},
+ {"ChartReuse", RGB(0x7f, 0xff, 0x00)},
+ {"GreenYellow", RGB(0xad, 0xff, 0x2f)},
+ {"DarkGreen", RGB(0x00, 0x64, 0x00)},
+ {"Green", RGB(0x00, 0x80, 0x00)},
+ {"ForestGreen", RGB(0x22, 0x8b, 0x22)},
+ {"Lime", RGB(0x00, 0xff, 0x00)},
+ {"LimeGreen", RGB(0x32, 0xcd, 0x32)},
+ {"LightGreen", RGB(0x90, 0xee, 0x90)},
+ {"PaleGreen", RGB(0x98, 0xfb, 0x98)},
+ {"DarkSeaGreen", RGB(0x8f, 0xbc, 0x8f)},
+ {"MediumSpringGreen", RGB(0x00, 0xfa, 0x9a)},
+ {"SpringGreen", RGB(0x00, 0xff, 0x7f)},
+ {"SeaGreen", RGB(0x2e, 0x8b, 0x57)},
+ {"MediumAquamarine", RGB(0x66, 0xcd, 0xaa)},
+ {"MediumSeaGreen", RGB(0x3c, 0xb3, 0x71)},
+ {"LightSeaGreen", RGB(0x20, 0xb2, 0xaa)},
+ {"DarkSlateGray", RGB(0x2f, 0x4f, 0x4f)},
+ {"Teal", RGB(0x00, 0x80, 0x80)},
+ {"DarkCyan", RGB(0x00, 0x8b, 0x8b)},
+ {"Aqua", RGB(0x00, 0xff, 0xff)},
+ {"Cyan", RGB(0x00, 0xff, 0xff)},
+ {"LightCyan", RGB(0xe0, 0xff, 0xff)},
+ {"DarkTurquoise", RGB(0x00, 0xce, 0xd1)},
+ {"Turquoise", RGB(0x40, 0xe0, 0xd0)},
+ {"MediumTurquoise", RGB(0x48, 0xd1, 0xcc)},
+ {"PaleTurquoise", RGB(0xaf, 0xee, 0xee)},
+ {"Aquamarine", RGB(0x7f, 0xff, 0xd4)},
+ {"PowderBlue", RGB(0xb0, 0xe0, 0xe6)},
+ {"CadetBlue", RGB(0x5f, 0x9e, 0xa0)},
+ {"SteelBlue", RGB(0x46, 0x82, 0xb4)},
+ {"CornFlowerBlue", RGB(0x64, 0x95, 0xed)},
+ {"DeepSkyBlue", RGB(0x00, 0xbf, 0xff)},
+ {"DodgerBlue", RGB(0x1e, 0x90, 0xff)},
+ {"LightBlue", RGB(0xad, 0xd8, 0xe6)},
+ {"SkyBlue", RGB(0x87, 0xce, 0xeb)},
+ {"LightSkyBlue", RGB(0x87, 0xce, 0xfa)},
+ {"MidnightBlue", RGB(0x19, 0x19, 0x70)},
+ {"Navy", RGB(0x00, 0x00, 0x80)},
+ {"DarkBlue", RGB(0x00, 0x00, 0x8b)},
+ {"MediumBlue", RGB(0x00, 0x00, 0xcd)},
+ {"Blue", RGB(0x00, 0x00, 0xff)},
+ {"RoyalBlue", RGB(0x41, 0x69, 0xe1)},
+ {"BlueViolet", RGB(0x8a, 0x2b, 0xe2)},
+ {"Indigo", RGB(0x4b, 0x00, 0x82)},
+ {"DarkSlateBlue", RGB(0x48, 0x3d, 0x8b)},
+ {"SlateBlue", RGB(0x6a, 0x5a, 0xcd)},
+ {"MediumSlateBlue", RGB(0x7b, 0x68, 0xee)},
+ {"MediumPurple", RGB(0x93, 0x70, 0xdb)},
+ {"DarkMagenta", RGB(0x8b, 0x00, 0x8b)},
+ {"DarkViolet", RGB(0x94, 0x00, 0xd3)},
+ {"DarkOrchid", RGB(0x99, 0x32, 0xcc)},
+ {"MediumOrchid", RGB(0xba, 0x55, 0xd3)},
+ {"Purple", RGB(0x80, 0x00, 0x80)},
+ {"Thistle", RGB(0xd8, 0xbf, 0xd8)},
+ {"Plum", RGB(0xdd, 0xa0, 0xdd)},
+ {"Violet", RGB(0xee, 0x82, 0xee)},
+ {"Magenta", RGB(0xff, 0x00, 0xff)},
+ {"Fuchsia", RGB(0xff, 0x00, 0xff)},
+ {"Orchid", RGB(0xda, 0x70, 0xd6)},
+ {"MediumVioletRed", RGB(0xc7, 0x15, 0x85)},
+ {"PaleVioletRed", RGB(0xdb, 0x70, 0x93)},
+ {"DeepPink", RGB(0xff, 0x14, 0x93)},
+ {"HotPink", RGB(0xff, 0x69, 0xb4)},
+ {"LightPink", RGB(0xff, 0xb6, 0xc1)},
+ {"Pink", RGB(0xff, 0xc0, 0xcb)},
+ {"AntiqueWhite", RGB(0xfa, 0xeb, 0xd7)},
+ {"Beige", RGB(0xf5, 0xf5, 0xdc)},
+ {"Bisque", RGB(0xff, 0xe4, 0xc4)},
+ {"BlanchedAlmond", RGB(0xff, 0xeb, 0xcd)},
+ {"Wheat", RGB(0xf5, 0xde, 0xb3)},
+ {"Cornsilk", RGB(0xff, 0xf8, 0xdc)},
+ {"LemonChiffon", RGB(0xff, 0xfa, 0xcd)},
+ {"LightGoldenRodYellow", RGB(0xfa, 0xfa, 0xd2)},
+ {"LightYellow", RGB(0xff, 0xff, 0xe0)},
+ {"SaddleBrown", RGB(0x8b, 0x45, 0x13)},
+ {"Sienna", RGB(0xa0, 0x52, 0x2d)},
+ {"Chocolate", RGB(0xd2, 0x69, 0x1e)},
+ {"Peru", RGB(0xcd, 0x85, 0x3f)},
+ {"SandyBrown", RGB(0xf4, 0xa4, 0x60)},
+ {"BurlyWood", RGB(0xde, 0xb8, 0x87)},
+ {"Tan", RGB(0xd2, 0xb4, 0x8c)},
+ {"RosyBrown", RGB(0xbc, 0x8f, 0x8f)},
+ {"Moccasin", RGB(0xff, 0xe4, 0xb5)},
+ {"NavajoWhite", RGB(0xff, 0xde, 0xad)},
+ {"PeachPuff", RGB(0xff, 0xda, 0xb9)},
+ {"MistyRose", RGB(0xff, 0xe4, 0xe1)},
+ {"LavenderBlush", RGB(0xff, 0xf0, 0xf5)},
+ {"Linen", RGB(0xfa, 0xf0, 0xe6)},
+ {"Oldlace", RGB(0xfd, 0xf5, 0xe6)},
+ {"PapayaWhip", RGB(0xff, 0xef, 0xd5)},
+ {"SeaShell", RGB(0xff, 0xf5, 0xee)},
+ {"MintCream", RGB(0xf5, 0xff, 0xfa)},
+ {"SlateGray", RGB(0x70, 0x80, 0x90)},
+ {"LightSlateGray", RGB(0x77, 0x88, 0x99)},
+ {"LightSteelBlue", RGB(0xb0, 0xc4, 0xde)},
+ {"Lavender", RGB(0xe6, 0xe6, 0xfa)},
+ {"FloralWhite", RGB(0xff, 0xfa, 0xf0)},
+ {"AliceBlue", RGB(0xf0, 0xf8, 0xff)},
+ {"GhostWhite", RGB(0xf8, 0xf8, 0xff)},
+ {"Honeydew", RGB(0xf0, 0xff, 0xf0)},
+ {"Ivory", RGB(0xff, 0xff, 0xf0)},
+ {"Azure", RGB(0xf0, 0xff, 0xff)},
+ {"Snow", RGB(0xff, 0xfa, 0xfa)},
+ {"Black", RGB(0x00, 0x00, 0x00)},
+ {"DimGray", RGB(0x69, 0x69, 0x69)},
+ {"DimGrey", RGB(0x69, 0x69, 0x69)},
+ {"Gray", RGB(0x80, 0x80, 0x80)},
+ {"Grey", RGB(0x80, 0x80, 0x80)},
+ {"DarkGray", RGB(0xa9, 0xa9, 0xa9)},
+ {"DarkGrey", RGB(0xa9, 0xa9, 0xa9)},
+ {"Silver", RGB(0xc0, 0xc0, 0xc0)},
+ {"LightGray", RGB(0xd3, 0xd3, 0xd3)},
+ {"LightGrey", RGB(0xd3, 0xd3, 0xd3)},
+ {"Gainsboro", RGB(0xdc, 0xdc, 0xdc)},
+ {"WhiteSmoke", RGB(0xf5, 0xf5, 0xf5)},
+ {"White", RGB(0xff, 0xff, 0xff)},
+ // The color names below were taken from gui_x11.c in vim source
+ {"LightRed", RGB(0xff, 0xbb, 0xbb)},
+ {"LightMagenta",RGB(0xff, 0xbb, 0xff)},
+ {"DarkYellow", RGB(0xbb, 0xbb, 0x00)},
+ {"Gray10", RGB(0x1a, 0x1a, 0x1a)},
+ {"Grey10", RGB(0x1a, 0x1a, 0x1a)},
+ {"Gray20", RGB(0x33, 0x33, 0x33)},
+ {"Grey20", RGB(0x33, 0x33, 0x33)},
+ {"Gray30", RGB(0x4d, 0x4d, 0x4d)},
+ {"Grey30", RGB(0x4d, 0x4d, 0x4d)},
+ {"Gray40", RGB(0x66, 0x66, 0x66)},
+ {"Grey40", RGB(0x66, 0x66, 0x66)},
+ {"Gray50", RGB(0x7f, 0x7f, 0x7f)},
+ {"Grey50", RGB(0x7f, 0x7f, 0x7f)},
+ {"Gray60", RGB(0x99, 0x99, 0x99)},
+ {"Grey60", RGB(0x99, 0x99, 0x99)},
+ {"Gray70", RGB(0xb3, 0xb3, 0xb3)},
+ {"Grey70", RGB(0xb3, 0xb3, 0xb3)},
+ {"Gray80", RGB(0xcc, 0xcc, 0xcc)},
+ {"Grey80", RGB(0xcc, 0xcc, 0xcc)},
+ {"Gray90", RGB(0xe5, 0xe5, 0xe5)},
+ {"Grey90", RGB(0xe5, 0xe5, 0xe5)},
+ {NULL, 0},
+};
RgbValue name_to_color(uint8_t *name)
{
-#define RGB(r, g, b) ((r << 16) | (g << 8) | b)
- static struct {
- char *name;
- RgbValue color;
- } color_name_table[] = {
- // Color names taken from
- // http://www.rapidtables.com/web/color/RGB_Color.htm
- {"Maroon", RGB(0x80, 0x00, 0x00)},
- {"DarkRed", RGB(0x8b, 0x00, 0x00)},
- {"Brown", RGB(0xa5, 0x2a, 0x2a)},
- {"Firebrick", RGB(0xb2, 0x22, 0x22)},
- {"Crimson", RGB(0xdc, 0x14, 0x3c)},
- {"Red", RGB(0xff, 0x00, 0x00)},
- {"Tomato", RGB(0xff, 0x63, 0x47)},
- {"Coral", RGB(0xff, 0x7f, 0x50)},
- {"IndianRed", RGB(0xcd, 0x5c, 0x5c)},
- {"LightCoral", RGB(0xf0, 0x80, 0x80)},
- {"DarkSalmon", RGB(0xe9, 0x96, 0x7a)},
- {"Salmon", RGB(0xfa, 0x80, 0x72)},
- {"LightSalmon", RGB(0xff, 0xa0, 0x7a)},
- {"OrangeRed", RGB(0xff, 0x45, 0x00)},
- {"DarkOrange", RGB(0xff, 0x8c, 0x00)},
- {"Orange", RGB(0xff, 0xa5, 0x00)},
- {"Gold", RGB(0xff, 0xd7, 0x00)},
- {"DarkGoldenRod", RGB(0xb8, 0x86, 0x0b)},
- {"GoldenRod", RGB(0xda, 0xa5, 0x20)},
- {"PaleGoldenRod", RGB(0xee, 0xe8, 0xaa)},
- {"DarkKhaki", RGB(0xbd, 0xb7, 0x6b)},
- {"Khaki", RGB(0xf0, 0xe6, 0x8c)},
- {"Olive", RGB(0x80, 0x80, 0x00)},
- {"Yellow", RGB(0xff, 0xff, 0x00)},
- {"YellowGreen", RGB(0x9a, 0xcd, 0x32)},
- {"DarkOliveGreen", RGB(0x55, 0x6b, 0x2f)},
- {"OliveDrab", RGB(0x6b, 0x8e, 0x23)},
- {"LawnGreen", RGB(0x7c, 0xfc, 0x00)},
- {"ChartReuse", RGB(0x7f, 0xff, 0x00)},
- {"GreenYellow", RGB(0xad, 0xff, 0x2f)},
- {"DarkGreen", RGB(0x00, 0x64, 0x00)},
- {"Green", RGB(0x00, 0x80, 0x00)},
- {"ForestGreen", RGB(0x22, 0x8b, 0x22)},
- {"Lime", RGB(0x00, 0xff, 0x00)},
- {"LimeGreen", RGB(0x32, 0xcd, 0x32)},
- {"LightGreen", RGB(0x90, 0xee, 0x90)},
- {"PaleGreen", RGB(0x98, 0xfb, 0x98)},
- {"DarkSeaGreen", RGB(0x8f, 0xbc, 0x8f)},
- {"MediumSpringGreen", RGB(0x00, 0xfa, 0x9a)},
- {"SpringGreen", RGB(0x00, 0xff, 0x7f)},
- {"SeaGreen", RGB(0x2e, 0x8b, 0x57)},
- {"MediumAquamarine", RGB(0x66, 0xcd, 0xaa)},
- {"MediumSeaGreen", RGB(0x3c, 0xb3, 0x71)},
- {"LightSeaGreen", RGB(0x20, 0xb2, 0xaa)},
- {"DarkSlateGray", RGB(0x2f, 0x4f, 0x4f)},
- {"Teal", RGB(0x00, 0x80, 0x80)},
- {"DarkCyan", RGB(0x00, 0x8b, 0x8b)},
- {"Aqua", RGB(0x00, 0xff, 0xff)},
- {"Cyan", RGB(0x00, 0xff, 0xff)},
- {"LightCyan", RGB(0xe0, 0xff, 0xff)},
- {"DarkTurquoise", RGB(0x00, 0xce, 0xd1)},
- {"Turquoise", RGB(0x40, 0xe0, 0xd0)},
- {"MediumTurquoise", RGB(0x48, 0xd1, 0xcc)},
- {"PaleTurquoise", RGB(0xaf, 0xee, 0xee)},
- {"Aquamarine", RGB(0x7f, 0xff, 0xd4)},
- {"PowderBlue", RGB(0xb0, 0xe0, 0xe6)},
- {"CadetBlue", RGB(0x5f, 0x9e, 0xa0)},
- {"SteelBlue", RGB(0x46, 0x82, 0xb4)},
- {"CornFlowerBlue", RGB(0x64, 0x95, 0xed)},
- {"DeepSkyBlue", RGB(0x00, 0xbf, 0xff)},
- {"DodgerBlue", RGB(0x1e, 0x90, 0xff)},
- {"LightBlue", RGB(0xad, 0xd8, 0xe6)},
- {"SkyBlue", RGB(0x87, 0xce, 0xeb)},
- {"LightSkyBlue", RGB(0x87, 0xce, 0xfa)},
- {"MidnightBlue", RGB(0x19, 0x19, 0x70)},
- {"Navy", RGB(0x00, 0x00, 0x80)},
- {"DarkBlue", RGB(0x00, 0x00, 0x8b)},
- {"MediumBlue", RGB(0x00, 0x00, 0xcd)},
- {"Blue", RGB(0x00, 0x00, 0xff)},
- {"RoyalBlue", RGB(0x41, 0x69, 0xe1)},
- {"BlueViolet", RGB(0x8a, 0x2b, 0xe2)},
- {"Indigo", RGB(0x4b, 0x00, 0x82)},
- {"DarkSlateBlue", RGB(0x48, 0x3d, 0x8b)},
- {"SlateBlue", RGB(0x6a, 0x5a, 0xcd)},
- {"MediumSlateBlue", RGB(0x7b, 0x68, 0xee)},
- {"MediumPurple", RGB(0x93, 0x70, 0xdb)},
- {"DarkMagenta", RGB(0x8b, 0x00, 0x8b)},
- {"DarkViolet", RGB(0x94, 0x00, 0xd3)},
- {"DarkOrchid", RGB(0x99, 0x32, 0xcc)},
- {"MediumOrchid", RGB(0xba, 0x55, 0xd3)},
- {"Purple", RGB(0x80, 0x00, 0x80)},
- {"Thistle", RGB(0xd8, 0xbf, 0xd8)},
- {"Plum", RGB(0xdd, 0xa0, 0xdd)},
- {"Violet", RGB(0xee, 0x82, 0xee)},
- {"Magenta", RGB(0xff, 0x00, 0xff)},
- {"Fuchsia", RGB(0xff, 0x00, 0xff)},
- {"Orchid", RGB(0xda, 0x70, 0xd6)},
- {"MediumVioletRed", RGB(0xc7, 0x15, 0x85)},
- {"PaleVioletRed", RGB(0xdb, 0x70, 0x93)},
- {"DeepPink", RGB(0xff, 0x14, 0x93)},
- {"HotPink", RGB(0xff, 0x69, 0xb4)},
- {"LightPink", RGB(0xff, 0xb6, 0xc1)},
- {"Pink", RGB(0xff, 0xc0, 0xcb)},
- {"AntiqueWhite", RGB(0xfa, 0xeb, 0xd7)},
- {"Beige", RGB(0xf5, 0xf5, 0xdc)},
- {"Bisque", RGB(0xff, 0xe4, 0xc4)},
- {"BlanchedAlmond", RGB(0xff, 0xeb, 0xcd)},
- {"Wheat", RGB(0xf5, 0xde, 0xb3)},
- {"Cornsilk", RGB(0xff, 0xf8, 0xdc)},
- {"LemonChiffon", RGB(0xff, 0xfa, 0xcd)},
- {"LightGoldenRodYellow", RGB(0xfa, 0xfa, 0xd2)},
- {"LightYellow", RGB(0xff, 0xff, 0xe0)},
- {"SaddleBrown", RGB(0x8b, 0x45, 0x13)},
- {"Sienna", RGB(0xa0, 0x52, 0x2d)},
- {"Chocolate", RGB(0xd2, 0x69, 0x1e)},
- {"Peru", RGB(0xcd, 0x85, 0x3f)},
- {"SandyBrown", RGB(0xf4, 0xa4, 0x60)},
- {"BurlyWood", RGB(0xde, 0xb8, 0x87)},
- {"Tan", RGB(0xd2, 0xb4, 0x8c)},
- {"RosyBrown", RGB(0xbc, 0x8f, 0x8f)},
- {"Moccasin", RGB(0xff, 0xe4, 0xb5)},
- {"NavajoWhite", RGB(0xff, 0xde, 0xad)},
- {"PeachPuff", RGB(0xff, 0xda, 0xb9)},
- {"MistyRose", RGB(0xff, 0xe4, 0xe1)},
- {"LavenderBlush", RGB(0xff, 0xf0, 0xf5)},
- {"Linen", RGB(0xfa, 0xf0, 0xe6)},
- {"Oldlace", RGB(0xfd, 0xf5, 0xe6)},
- {"PapayaWhip", RGB(0xff, 0xef, 0xd5)},
- {"SeaShell", RGB(0xff, 0xf5, 0xee)},
- {"MintCream", RGB(0xf5, 0xff, 0xfa)},
- {"SlateGray", RGB(0x70, 0x80, 0x90)},
- {"LightSlateGray", RGB(0x77, 0x88, 0x99)},
- {"LightSteelBlue", RGB(0xb0, 0xc4, 0xde)},
- {"Lavender", RGB(0xe6, 0xe6, 0xfa)},
- {"FloralWhite", RGB(0xff, 0xfa, 0xf0)},
- {"AliceBlue", RGB(0xf0, 0xf8, 0xff)},
- {"GhostWhite", RGB(0xf8, 0xf8, 0xff)},
- {"Honeydew", RGB(0xf0, 0xff, 0xf0)},
- {"Ivory", RGB(0xff, 0xff, 0xf0)},
- {"Azure", RGB(0xf0, 0xff, 0xff)},
- {"Snow", RGB(0xff, 0xfa, 0xfa)},
- {"Black", RGB(0x00, 0x00, 0x00)},
- {"DimGray", RGB(0x69, 0x69, 0x69)},
- {"DimGrey", RGB(0x69, 0x69, 0x69)},
- {"Gray", RGB(0x80, 0x80, 0x80)},
- {"Grey", RGB(0x80, 0x80, 0x80)},
- {"DarkGray", RGB(0xa9, 0xa9, 0xa9)},
- {"DarkGrey", RGB(0xa9, 0xa9, 0xa9)},
- {"Silver", RGB(0xc0, 0xc0, 0xc0)},
- {"LightGray", RGB(0xd3, 0xd3, 0xd3)},
- {"LightGrey", RGB(0xd3, 0xd3, 0xd3)},
- {"Gainsboro", RGB(0xdc, 0xdc, 0xdc)},
- {"WhiteSmoke", RGB(0xf5, 0xf5, 0xf5)},
- {"White", RGB(0xff, 0xff, 0xff)},
- // The color names below were taken from gui_x11.c in vim source
- {"LightRed", RGB(0xff, 0xbb, 0xbb)},
- {"LightMagenta",RGB(0xff, 0xbb, 0xff)},
- {"DarkYellow", RGB(0xbb, 0xbb, 0x00)},
- {"Gray10", RGB(0x1a, 0x1a, 0x1a)},
- {"Grey10", RGB(0x1a, 0x1a, 0x1a)},
- {"Gray20", RGB(0x33, 0x33, 0x33)},
- {"Grey20", RGB(0x33, 0x33, 0x33)},
- {"Gray30", RGB(0x4d, 0x4d, 0x4d)},
- {"Grey30", RGB(0x4d, 0x4d, 0x4d)},
- {"Gray40", RGB(0x66, 0x66, 0x66)},
- {"Grey40", RGB(0x66, 0x66, 0x66)},
- {"Gray50", RGB(0x7f, 0x7f, 0x7f)},
- {"Grey50", RGB(0x7f, 0x7f, 0x7f)},
- {"Gray60", RGB(0x99, 0x99, 0x99)},
- {"Grey60", RGB(0x99, 0x99, 0x99)},
- {"Gray70", RGB(0xb3, 0xb3, 0xb3)},
- {"Grey70", RGB(0xb3, 0xb3, 0xb3)},
- {"Gray80", RGB(0xcc, 0xcc, 0xcc)},
- {"Grey80", RGB(0xcc, 0xcc, 0xcc)},
- {"Gray90", RGB(0xe5, 0xe5, 0xe5)},
- {"Grey90", RGB(0xe5, 0xe5, 0xe5)},
- {NULL, 0},
- };
if (name[0] == '#' && isxdigit(name[1]) && isxdigit(name[2])
&& isxdigit(name[3]) && isxdigit(name[4]) && isxdigit(name[5])
diff --git a/src/nvim/syntax.h b/src/nvim/syntax.h
index 9a284c8a8d..93088180b9 100644
--- a/src/nvim/syntax.h
+++ b/src/nvim/syntax.h
@@ -38,6 +38,12 @@
#define HL_CONCEAL 0x20000 /* can be concealed */
#define HL_CONCEALENDS 0x40000 /* can be concealed */
+typedef struct {
+ char *name;
+ RgbValue color;
+} color_name_table_T;
+extern color_name_table_T color_name_table[];
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "syntax.h.generated.h"
#endif
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 6056a9d2a7..8a5a3dc07d 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -4,6 +4,8 @@
/// Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred).
#include <inttypes.h>
+#include <assert.h>
+#include <limits.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
@@ -57,7 +59,6 @@ static char *(features[]) = {
"+cursorbind",
"+cursorshape",
"+dialog_con",
- "+diff",
"+digraphs",
"-dnd",
"-ebcdic",
@@ -1008,8 +1009,8 @@ void maybe_intro_message(void)
void intro_message(int colon)
{
int i;
- int row;
- int blanklines;
+ long row;
+ long blanklines;
int sponsor;
char *p;
static char *(lines[]) = {
@@ -1027,7 +1028,10 @@ void intro_message(int colon)
};
// blanklines = screen height - # message lines
- blanklines = (int)Rows - (ARRAY_SIZE(lines) - 1);
+ size_t lines_size = ARRAY_SIZE(lines);
+ assert(lines_size <= LONG_MAX);
+
+ blanklines = Rows - ((long)lines_size - 1l);
// Don't overwrite a statusline. Depends on 'cmdheight'.
if (p_ls > 1) {
@@ -1073,13 +1077,14 @@ void intro_message(int colon)
// Make the wait-return message appear just below the text.
if (colon) {
- msg_row = row;
+ assert(row <= INT_MAX);
+ msg_row = (int)row;
}
}
-static void do_intro_line(int row, char_u *mesg, int attr)
+static void do_intro_line(long row, char_u *mesg, int attr)
{
- int col;
+ long col;
char_u *p;
int l;
int clen;
@@ -1106,7 +1111,8 @@ static void do_intro_line(int row, char_u *mesg, int attr)
clen += byte2cells(p[l]);
}
}
- screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr);
+ assert(row <= INT_MAX && col <= INT_MAX);
+ screen_puts_len(p, l, (int)row, (int)col, *p == '<' ? hl_attr(HLF_8) : attr);
col += clen;
}
}