diff options
31 files changed, 1415 insertions, 622 deletions
@@ -111,6 +111,7 @@ test: functionaltest unittest clean: +test -d build && $(BUILD_CMD) -C build clean || true $(MAKE) -C src/nvim/testdir clean + $(MAKE) -C runtime/doc clean distclean: clean rm -rf .deps build diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index 9e32067204..d13640540b 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -87,9 +87,9 @@ function! s:indent_after_line1(s, columns) abort return join(lines, "\n") endfunction -" Changes ':help clipboard' to '|clipoard|'. Also removes surrounding quotes. +" Changes ':h clipboard' to ':help |clipboard|'. function! s:help_to_link(s) abort - return substitute(a:s, '\v[''"]?:h%[elp] ([^''"]+)[''"]?', '|\1|', 'g') + return substitute(a:s, '\v[''"]?:h%[elp] ([^''"]+)[''"]?', '":help |\1|"', 'g') endfunction " Format a message for a specific report item diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index d3e1fef483..c16f62cf59 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -108,7 +108,7 @@ function! s:check_clipboard() abort if empty(clipboard_tool) call health#report_warn( \ "No clipboard tool found. Using the system clipboard won't work.", - \ ['See |clipboard|.']) + \ ['See ":help clipboard".']) else call health#report_ok('Clipboard tool found: '. clipboard_tool) endif diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile index 3d10d0ea98..dabbcd08d9 100644 --- a/runtime/doc/Makefile +++ b/runtime/doc/Makefile @@ -36,5 +36,5 @@ tags.ref tags.html: tags $(AWK) -f maketags.awk tags >tags.html clean: - -rm -f *.html tags.ref $(HTMLS) errors.log + -rm -f *.html tags.ref $(HTMLS) errors.log tags diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index cca53db531..53f14c7d47 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2032,6 +2032,8 @@ matchlist({expr}, {pat}[, {start}[, {count}]]) List match and submatches of {pat} in {expr} matchstr({expr}, {pat}[, {start}[, {count}]]) String {count}'th match of {pat} in {expr} +matchstrpos( {expr}, {pat}[, {start}[, {count}]]) + List {count}'th match of {pat} in {expr} max({list}) Number maximum value of items in {list} min({list}) Number minimum value of items in {list} mkdir({name} [, {path} [, {prot}]]) @@ -5019,6 +5021,24 @@ matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()* When {expr} is a |List| then the matching item is returned. The type isn't changed, it's not necessarily a String. +matchstrpos({expr}, {pat}[, {start}[, {count}]]) *matchstrpos()* + Same as |matchstr()|, but return the matched string, the start + position and the end position of the match. Example: > + :echo matchstrpos("testing", "ing") +< results in ["ing", 4, 7]. + When there is no match ["", -1, -1] is returned. + The {start}, if given, has the same meaning as for |match()|. > + :echo matchstrpos("testing", "ing", 2) +< results in ["ing", 4, 7]. > + :echo matchstrpos("testing", "ing", 5) +< result is ["", -1, -1]. + When {expr} is a |List| then the matching item, the index + of first item where {pat} matches, the start position and the + end position of the match are returned. > + :echo matchstrpos([1, '__x'], '\a') +< result is ["x", 1, 2, 3]. + The type isn't changed, it's not necessarily a String. + *max()* max({list}) Return the maximum value of all items in {list}. If {list} is not a list or one of the items in {list} cannot diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 9d8d1f84c8..7cfc55ed79 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5409,8 +5409,7 @@ A jump table for the options with a short description can be found at |Q_op|. The |FilterReadPre|, |FilterReadPost| and |FilterWritePre|, |FilterWritePost| autocommands event are not triggered when 'shelltemp' is off. - The `system()` function does not respect this option and always uses - temp files. + |system()| does not respect this option, it always uses pipes. *'shellxescape'* *'sxe'* 'shellxescape' 'sxe' string (default: ""; diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 4d3ad49f1f..2896611274 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -592,6 +592,7 @@ String manipulation: *string-functions* match() position where a pattern matches in a string matchend() position where a pattern match ends in a string matchstr() match of a pattern in a string + matchstrpos() match and postions of a pattern in a string matchlist() like matchstr() and also return submatches stridx() first index of a short string in a long string strridx() last index of a short string in a long string diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index b8acd901a8..63bafa1925 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -1,7 +1,7 @@ " Maintainer: Anmol Sethi <anmol@aubble.com> " Previous Maintainer: SungHyun Nam <goweol@gmail.com> -if exists('b:did_ftplugin') +if exists('b:did_ftplugin') || &filetype !=# 'man' finish endif let b:did_ftplugin = 1 diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 8e6066453c..80db0e2ebc 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4149,12 +4149,10 @@ do_arg_all ( wpnext = wp->w_next; buf = wp->w_buffer; if (buf->b_ffname == NULL - || (!keep_tabs && buf->b_nwindows > 1) - || wp->w_width != Columns - ) + || (!keep_tabs && (buf->b_nwindows > 1 || wp->w_width != Columns))) { i = opened_len; - else { - /* check if the buffer in this window is in the arglist */ + } else { + // check if the buffer in this window is in the arglist for (i = 0; i < opened_len; ++i) { if (i < alist->al_ga.ga_len && (AARGLIST(alist)[i].ae_fnum == buf->b_fnum diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 4f0de1451a..2f0e8ad974 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -877,16 +877,17 @@ struct frame_S { * match functions there is a different pattern for each window. */ typedef struct { - regmmatch_T rm; /* points to the regexp program; contains last found - match (may continue in next line) */ - buf_T *buf; /* the buffer to search for a match */ - linenr_T lnum; /* the line to search for a match */ - int attr; /* attributes to be used for a match */ - int attr_cur; /* attributes currently active in win_line() */ - linenr_T first_lnum; /* first lnum to search for multi-line pat */ - colnr_T startcol; /* in win_line() points to char where HL starts */ - colnr_T endcol; /* in win_line() points to char where HL ends */ - proftime_T tm; /* for a time limit */ + regmmatch_T rm; // points to the regexp program; contains last found + // match (may continue in next line) + buf_T *buf; // the buffer to search for a match + linenr_T lnum; // the line to search for a match + int attr; // attributes to be used for a match + int attr_cur; // attributes currently active in win_line() + linenr_T first_lnum; // first lnum to search for multi-line pat + colnr_T startcol; // in win_line() points to char where HL starts + colnr_T endcol; // in win_line() points to char where HL ends + bool is_addpos; // position specified directly by matchaddpos() + proftime_T tm; // for a time limit } match_T; /// number of positions supported by matchaddpos() diff --git a/src/nvim/charset.c b/src/nvim/charset.c index c501b7e83f..4d150c3230 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -59,12 +59,8 @@ static char_u g_chartab[256]; /// Depends on the option settings 'iskeyword', 'isident', 'isfname', /// 'isprint' and 'encoding'. /// -/// The index in g_chartab[] depends on 'encoding': -/// - For non-multi-byte index with the byte (same as the character). -/// - For DBCS index with the first byte. -/// - For UTF-8 index with the character (when first byte is up to 0x80 it is -/// the same as the character, if the first byte is 0x80 and above it depends -/// on further bytes). +/// The index in g_chartab[] is the character when first byte is up to 0x80, +/// if the first byte is 0x80 and above it depends on further bytes. /// /// The contents of g_chartab[]: /// - The lower two bits, masked by CT_CELL_MASK, give the number of display @@ -118,15 +114,9 @@ int buf_init_chartab(buf_T *buf, int global) } while (c < 256) { - if (enc_utf8 && (c >= 0xa0)) { + if (c >= 0xa0) { // UTF-8: bytes 0xa0 - 0xff are printable (latin1) g_chartab[c++] = CT_PRINT_CHAR + 1; - } else if ((enc_dbcs == DBCS_JPNU) && (c == 0x8e)) { - // euc-jp characters starting with 0x8e are single width - g_chartab[c++] = CT_PRINT_CHAR + 1; - } else if ((enc_dbcs != 0) && (MB_BYTE2LEN(c) == 2)) { - // other double-byte chars can be printable AND double-width - g_chartab[c++] = CT_PRINT_CHAR + 2; } else { // the rest is unprintable by default g_chartab[c++] = (dy_flags & DY_UHEX) ? 4 : 2; @@ -134,10 +124,8 @@ int buf_init_chartab(buf_T *buf, int global) } // Assume that every multi-byte char is a filename character. - for (c = 1; c < 256; ++c) { - if (((enc_dbcs != 0) && (MB_BYTE2LEN(c) > 1)) - || ((enc_dbcs == DBCS_JPNU) && (c == 0x8e)) - || (enc_utf8 && (c >= 0xa0))) { + for (c = 1; c < 256; c++) { + if (c >= 0xa0) { g_chartab[c] |= CT_FNAME_CHAR; } } @@ -146,15 +134,6 @@ int buf_init_chartab(buf_T *buf, int global) // Init word char flags all to false memset(buf->b_chartab, 0, (size_t)32); - if (enc_dbcs != 0) { - for (c = 0; c < 256; ++c) { - // double-byte characters are probably word characters - if (MB_BYTE2LEN(c) == 2) { - SET_CHARTAB(buf, c); - } - } - } - // In lisp mode the '-' character is included in keywords. if (buf->b_p_lisp) { SET_CHARTAB(buf, '-'); @@ -189,10 +168,8 @@ int buf_init_chartab(buf_T *buf, int global) if (ascii_isdigit(*p)) { c = getdigits_int(&p); - } else if (has_mbyte) { - c = mb_ptr2char_adv(&p); } else { - c = *p++; + c = mb_ptr2char_adv(&p); } c2 = -1; @@ -201,10 +178,8 @@ int buf_init_chartab(buf_T *buf, int global) if (ascii_isdigit(*p)) { c2 = getdigits_int(&p); - } else if (has_mbyte) { - c2 = mb_ptr2char_adv(&p); } else { - c2 = *p++; + c2 = mb_ptr2char_adv(&p); } } @@ -251,8 +226,7 @@ int buf_init_chartab(buf_T *buf, int global) // that we can detect it from the first byte. if (((c < ' ') || (c > '~') - || (p_altkeymap && (F_isalpha(c) || F_isdigit(c)))) - && !(enc_dbcs && (MB_BYTE2LEN(c) == 2))) { + || (p_altkeymap && (F_isalpha(c) || F_isdigit(c))))) { if (tilde) { g_chartab[c] = (uint8_t)((g_chartab[c] & ~CT_CELL_MASK) + ((dy_flags & DY_UHEX) ? 4 : 2)); @@ -313,7 +287,7 @@ void trans_characters(char_u *buf, int bufsize) while (*buf != 0) { // Assume a multi-byte character doesn't need translation. - if (has_mbyte && ((trs_len = (*mb_ptr2len)(buf)) > 1)) { + if ((trs_len = (*mb_ptr2len)(buf)) > 1) { len -= trs_len; } else { trs = transchar_byte(*buf); @@ -347,44 +321,40 @@ char_u *transstr(char_u *s) FUNC_ATTR_NONNULL_RET size_t l; char_u hexbuf[11]; - if (has_mbyte) { - // Compute the length of the result, taking account of unprintable - // multi-byte characters. - size_t len = 0; - p = s; + // Compute the length of the result, taking account of unprintable + // multi-byte characters. + size_t len = 0; + p = s; - while (*p != NUL) { - if ((l = (size_t)(*mb_ptr2len)(p)) > 1) { - c = (*mb_ptr2char)(p); - p += l; + while (*p != NUL) { + if ((l = (size_t)(*mb_ptr2len)(p)) > 1) { + c = (*mb_ptr2char)(p); + p += l; - if (vim_isprintc(c)) { - len += l; - } else { - transchar_hex(hexbuf, c); - len += STRLEN(hexbuf); - } + if (vim_isprintc(c)) { + len += l; } else { - l = (size_t)byte2cells(*p++); + transchar_hex(hexbuf, c); + len += STRLEN(hexbuf); + } + } else { + l = (size_t)byte2cells(*p++); - if (l > 0) { - len += l; - } else { - // illegal byte sequence - len += 4; - } + if (l > 0) { + len += l; + } else { + // illegal byte sequence + len += 4; } } - res = xmallocz(len); - } else { - res = xmallocz((size_t)vim_strsize(s)); } + res = xmallocz(len); *res = NUL; p = s; while (*p != NUL) { - if (has_mbyte && ((l = (size_t)(*mb_ptr2len)(p)) > 1)) { + if ((l = (size_t)(*mb_ptr2len)(p)) > 1) { c = (*mb_ptr2char)(p); if (vim_isprintc(c)) { @@ -443,59 +413,49 @@ char_u* str_foldcase(char_u *str, int orglen, char_u *buf, int buflen) // Make each character lower case. i = 0; while (STR_CHAR(i) != NUL) { - if (enc_utf8 || (has_mbyte && (MB_BYTE2LEN(STR_CHAR(i)) > 1))) { - if (enc_utf8) { - int c = utf_ptr2char(STR_PTR(i)); - int olen = utf_ptr2len(STR_PTR(i)); - int lc = utf_tolower(c); - - // Only replace the character when it is not an invalid - // sequence (ASCII character or more than one byte) and - // utf_tolower() doesn't return the original character. - if (((c < 0x80) || (olen > 1)) && (c != lc)) { - int nlen = utf_char2len(lc); - - // If the byte length changes need to shift the following - // characters forward or backward. - if (olen != nlen) { - if (nlen > olen) { - if (buf == NULL) { - ga_grow(&ga, nlen - olen + 1); - } else { - if (len + nlen - olen >= buflen) { - // out of memory, keep old char - lc = c; - nlen = olen; - } - } - } - - if (olen != nlen) { - if (buf == NULL) { - STRMOVE(GA_PTR(i) + nlen, GA_PTR(i) + olen); - ga.ga_len += nlen - olen; - } else { - STRMOVE(buf + i + nlen, buf + i + olen); - len += nlen - olen; - } + int c = utf_ptr2char(STR_PTR(i)); + int olen = utf_ptr2len(STR_PTR(i)); + int lc = utf_tolower(c); + + // Only replace the character when it is not an invalid + // sequence (ASCII character or more than one byte) and + // utf_tolower() doesn't return the original character. + if (((c < 0x80) || (olen > 1)) && (c != lc)) { + int nlen = utf_char2len(lc); + + // If the byte length changes need to shift the following + // characters forward or backward. + if (olen != nlen) { + if (nlen > olen) { + if (buf == NULL) { + ga_grow(&ga, nlen - olen + 1); + } else { + if (len + nlen - olen >= buflen) { + // out of memory, keep old char + lc = c; + nlen = olen; } } - (void)utf_char2bytes(lc, STR_PTR(i)); } - } - // skip to next multi-byte char - i += (*mb_ptr2len)(STR_PTR(i)); - } else { - if (buf == NULL) { - GA_CHAR(i) = (char_u)TOLOWER_LOC(GA_CHAR(i)); - } else { - buf[i] = (char_u)TOLOWER_LOC(buf[i]); + if (olen != nlen) { + if (buf == NULL) { + STRMOVE(GA_PTR(i) + nlen, GA_PTR(i) + olen); + ga.ga_len += nlen - olen; + } else { + STRMOVE(buf + i + nlen, buf + i + olen); + len += nlen - olen; + } + } } - ++i; + (void)utf_char2bytes(lc, STR_PTR(i)); } + + // skip to next multi-byte char + i += (*mb_ptr2len)(STR_PTR(i)); } + if (buf == NULL) { return (char_u *)ga.ga_data; } @@ -545,7 +505,7 @@ char_u* transchar(int c) /// @return pointer to translated character in transchar_buf. char_u* transchar_byte(int c) { - if (enc_utf8 && (c >= 0x80)) { + if (c >= 0x80) { transchar_nonprint(transchar_buf, c); return transchar_buf; } @@ -578,7 +538,7 @@ void transchar_nonprint(char_u *buf, int c) buf[1] = (char_u)(c ^ 0x40); buf[2] = NUL; - } else if (enc_utf8 && (c >= 0x80)) { + } else if (c >= 0x80) { transchar_hex(buf, c); } else if ((c >= ' ' + 0x80) && (c <= '~' + 0x80)) { // 0xa0 - 0xfe @@ -632,15 +592,15 @@ static unsigned nr2hex(unsigned c) /// Caller must make sure 0 <= b <= 255. /// For multi-byte mode "b" must be the first byte of a character. /// A TAB is counted as two cells: "^I". -/// For UTF-8 mode this will return 0 for bytes >= 0x80, because the number of -/// cells depends on further bytes. +/// This will return 0 for bytes >= 0x80, because the number of +/// cells depends on further bytes in UTF-8. /// /// @param b /// /// @reeturn Number of display cells. int byte2cells(int b) { - if (enc_utf8 && (b >= 0x80)) { + if (b >= 0x80) { return 0; } return g_chartab[b] & CT_CELL_MASK; @@ -662,18 +622,7 @@ int char2cells(int c) if (c >= 0x80) { // UTF-8: above 0x80 need to check the value - if (enc_utf8) { - return utf_char2cells(c); - } - - // DBCS: double-byte means double-width, except for euc-jp with first - // byte 0x8e - if ((enc_dbcs != 0) && (c >= 0x100)) { - if ((enc_dbcs == DBCS_JPNU) && (((unsigned)c >> 8) == 0x8e)) { - return 1; - } - return 2; - } + return utf_char2cells(c); } return g_chartab[c & 0xff] & CT_CELL_MASK; } @@ -687,7 +636,7 @@ int char2cells(int c) int ptr2cells(char_u *p) { // For UTF-8 we need to look at more bytes if the first byte is >= 0x80. - if (enc_utf8 && (*p >= 0x80)) { + if (*p >= 0x80) { return utf_ptr2cells(p); } @@ -722,14 +671,10 @@ int vim_strnsize(char_u *s, int len) assert(s != NULL); int size = 0; while (*s != NUL && --len >= 0) { - if (has_mbyte) { - int l = (*mb_ptr2len)(s); - size += ptr2cells(s); - s += l; - len -= l - 1; - } else { - size += byte2cells(*s++); - } + int l = (*mb_ptr2len)(s); + size += ptr2cells(s); + s += l; + len -= l - 1; } return size; } @@ -840,13 +785,7 @@ bool vim_iswordc_buf(int c, buf_T *buf) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(2) { if (c >= 0x100) { - if (enc_dbcs != 0) { - return dbcs_class((unsigned)c >> 8, (unsigned)(c & 0xff)) >= 2; - } - - if (enc_utf8) { - return utf_class(c) >= 2; - } + return utf_class(c) >= 2; } return c > 0 && c < 0x100 && GET_CHARTAB(buf, c) != 0; } @@ -859,7 +798,7 @@ bool vim_iswordc_buf(int c, buf_T *buf) bool vim_iswordp(char_u *p) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { - if (has_mbyte && (MB_BYTE2LEN(*p) > 1)) { + if (MB_BYTE2LEN(*p) > 1) { return mb_get_class(p) >= 2; } return GET_CHARTAB(curbuf, *p) != 0; @@ -875,7 +814,7 @@ bool vim_iswordp(char_u *p) bool vim_iswordp_buf(char_u *p, buf_T *buf) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { - if (has_mbyte && (MB_BYTE2LEN(*p) > 1)) { + if (MB_BYTE2LEN(*p) > 1) { return mb_get_class(p) >= 2; } return GET_CHARTAB(buf, *p) != 0; @@ -913,7 +852,7 @@ bool vim_isfilec_or_wc(int c) bool vim_isprintc(int c) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { - if (enc_utf8 && (c >= 0x100)) { + if (c >= 0x100) { return utf_printable(c); } return c >= 0x100 || (c > 0 && (g_chartab[c] & CT_PRINT_CHAR)); @@ -928,14 +867,10 @@ bool vim_isprintc(int c) bool vim_isprintc_strict(int c) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { - if ((enc_dbcs != 0) && (c < 0x100) && (MB_BYTE2LEN(c) > 1)) { - return false; - } - - if (enc_utf8 && (c >= 0x100)) { + if (c >= 0x100) { return utf_printable(c); } - return c >= 0x100 || (c > 0 && (g_chartab[c] & CT_PRINT_CHAR)); + return c > 0 && (g_chartab[c] & CT_PRINT_CHAR); } /// like chartabsize(), but also check for line breaks on the screen @@ -1052,8 +987,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he break; } } - } else if (has_mbyte - && (size == 2) + } else if ((size == 2) && (MB_BYTE2LEN(*s) > 1) && wp->w_p_wrap && in_win_border(wp, col)) { @@ -1251,28 +1185,24 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, if (c == TAB) { incr = ts - (vcol % ts); } else { - if (has_mbyte) { - // For utf-8, if the byte is >= 0x80, need to look at - // further bytes to find the cell width. - if (enc_utf8 && (c >= 0x80)) { - incr = utf_ptr2cells(ptr); - } else { - incr = g_chartab[c] & CT_CELL_MASK; - } - - // If a double-cell char doesn't fit at the end of a line - // it wraps to the next line, it's like this char is three - // cells wide. - if ((incr == 2) - && wp->w_p_wrap - && (MB_BYTE2LEN(*ptr) > 1) - && in_win_border(wp, vcol)) { - ++incr; - head = 1; - } + // For utf-8, if the byte is >= 0x80, need to look at + // further bytes to find the cell width. + if (c >= 0x80) { + incr = utf_ptr2cells(ptr); } else { incr = g_chartab[c] & CT_CELL_MASK; } + + // If a double-cell char doesn't fit at the end of a line + // it wraps to the next line, it's like this char is three + // cells wide. + if ((incr == 2) + && wp->w_p_wrap + && (MB_BYTE2LEN(*ptr) > 1) + && in_win_border(wp, vcol)) { + incr++; + head = 1; + } } if ((posptr != NULL) && (ptr >= posptr)) { @@ -1557,36 +1487,6 @@ char_u* skiptohex(char_u *q) // islower()/toupper() etc. do not work properly: they crash when used with // invalid values or can't handle latin1 when the locale is C. // Speed is most important here. -#define LATIN1LOWER 'l' -#define LATIN1UPPER 'U' - -static char_u latin1flags[257] = - " " - " UUUUUUUUUUUUUUUUUUUUUUUUUU llllllllllllllllllllllllll " - " " - "UUUUUUUUUUUUUUUUUUUUUUU UUUUUUUllllllllllllllllllllllll llllllll"; -static char_u latin1upper[257] = - " !\"#$%&'()*+,-./0123456789:;<=>" - "?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~" - "\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e" - "\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e" - "\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae" - "\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe" - "\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce" - "\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde" - "\xdf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce" - "\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xf7\xd8\xd9\xda\xdb\xdc\xdd\xde\xff"; -static char_u latin1lower[257] = - " !\"#$%&'()*+,-./0123456789:;<=>" - "?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" - "\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e" - "\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e" - "\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae" - "\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe" - "\xbf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee" - "\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xd7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" - "\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee" - "\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"; /// Check that the character is lower-case /// @@ -1599,20 +1499,7 @@ bool vim_islower(int c) } if (c >= 0x80) { - if (enc_utf8) { - return utf_islower(c); - } - - if (c >= 0x100) { - if (has_mbyte) { - return iswlower((wint_t)c); - } - - // islower() can't handle these chars and may crash - return false; - } - - return (latin1flags[c] & LATIN1LOWER) == LATIN1LOWER; + return utf_islower(c); } return islower(c); } @@ -1628,20 +1515,7 @@ bool vim_isupper(int c) } if (c >= 0x80) { - if (enc_utf8) { return utf_isupper(c); - } - - if (c >= 0x100) { - if (has_mbyte) { - return iswupper((wint_t)c); - } - - // isupper() can't handle these chars and may crash - return false; - } - - return (latin1flags[c] & LATIN1UPPER) == LATIN1UPPER; } return isupper(c); } @@ -1653,20 +1527,7 @@ int vim_toupper(int c) } if (c >= 0x80) { - if (enc_utf8) { - return utf_toupper(c); - } - - if (c >= 0x100) { - if (has_mbyte) { - return (int)towupper((wint_t)c); - } - - // toupper() can't handle these chars and may crash - return c; - } - - return latin1upper[c]; + return utf_toupper(c); } return TOUPPER_LOC(c); } @@ -1678,20 +1539,7 @@ int vim_tolower(int c) } if (c >= 0x80) { - if (enc_utf8) { - return utf_tolower(c); - } - - if (c >= 0x100) { - if (has_mbyte) { - return (int)towlower((wint_t)c); - } - - // tolower() can't handle these chars and may crash - return c; - } - - return latin1lower[c]; + return utf_tolower(c); } return TOLOWER_LOC(c); } diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8e8d36b442..ba5864fe3b 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -12211,9 +12211,16 @@ static void find_some_match(typval_T *argvars, typval_T *rettv, int type) p_cpo = (char_u *)""; rettv->vval.v_number = -1; - if (type == 3) { - /* return empty list when there are no matches */ + if (type == 3 || type == 4) { + // type 3: return empty list when there are no matches. + // type 4: return ["", -1, -1, -1] rettv_list_alloc(rettv); + if (type == 4) { + list_append_string(rettv->vval.v_list, (char_u *)"", 0); + list_append_number(rettv->vval.v_list, (varnumber_T)-1); + list_append_number(rettv->vval.v_list, (varnumber_T)-1); + list_append_number(rettv->vval.v_list, (varnumber_T)-1); + } } else if (type == 2) { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; @@ -12276,7 +12283,7 @@ static void find_some_match(typval_T *argvars, typval_T *rettv, int type) break; } xfree(tofree); - tofree = str = (char_u *) encode_tv2echo(&li->li_tv, NULL); + tofree = expr = str = (char_u *)encode_tv2echo(&li->li_tv, NULL); if (str == NULL) { break; } @@ -12304,7 +12311,19 @@ static void find_some_match(typval_T *argvars, typval_T *rettv, int type) } if (match) { - if (type == 3) { + if (type == 4) { + listitem_T *li1 = rettv->vval.v_list->lv_first; + listitem_T *li2 = li1->li_next; + listitem_T *li3 = li2->li_next; + listitem_T *li4 = li3->li_next; + int rd = (int)(regmatch.endp[0] - regmatch.startp[0]); + li1->li_tv.vval.v_string = vim_strnsave(regmatch.startp[0], rd); + li3->li_tv.vval.v_number = (varnumber_T)(regmatch.startp[0] - expr); + li4->li_tv.vval.v_number = (varnumber_T)(regmatch.endp[0] - expr); + if (l != NULL) { + li2->li_tv.vval.v_number = (varnumber_T)idx; + } + } else if (type == 3) { int i; /* return list with matched string and submatches */ @@ -12339,6 +12358,11 @@ static void find_some_match(typval_T *argvars, typval_T *rettv, int type) vim_regfree(regmatch.regprog); } + if (type == 4 && l == NULL) { + // matchstrpos() without a list: drop the second item + listitem_remove(rettv->vval.v_list, rettv->vval.v_list->lv_first->li_next); + } + theend: xfree(tofree); p_cpo = save_cpo; @@ -12511,6 +12535,11 @@ static void f_matchstr(typval_T *argvars, typval_T *rettv, FunPtr fptr) find_some_match(argvars, rettv, 2); } +/// "matchstrpos()" function +static void f_matchstrpos(typval_T *argvars, typval_T *rettv, FunPtr fptr) +{ + find_some_match(argvars, rettv, 4); +} static void max_min(typval_T *argvars, typval_T *rettv, int domax) { diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index bea25b36f3..61a5438d8c 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -198,6 +198,7 @@ return { matchend={args={2, 4}}, matchlist={args={2, 4}}, matchstr={args={2, 4}}, + matchstrpos={args={2,4}}, max={args=1}, min={args=1}, mkdir={args={1, 3}}, diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 76e3829bee..312777d3b9 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3646,10 +3646,11 @@ nv_gd ( size_t len; char_u *ptr; if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0 - || !find_decl(ptr, len, nchar == 'd', thisblock, 0)) + || !find_decl(ptr, len, nchar == 'd', thisblock, SEARCH_START)) { clearopbeep(oap); - else if ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP) + } else if ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP) { foldOpenCursor(); + } } /* diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 384568259f..d96858632f 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -723,13 +723,70 @@ static void nfa_emit_equi_class(int c) if (enc_utf8 || STRCMP(p_enc, "latin1") == 0 || STRCMP(p_enc, "iso-8859-15") == 0) { +#define A_grave 0xc0 +#define A_acute 0xc1 +#define A_circumflex 0xc2 +#define A_virguilla 0xc3 +#define A_diaeresis 0xc4 +#define A_ring 0xc5 +#define C_cedilla 0xc7 +#define E_grave 0xc8 +#define E_acute 0xc9 +#define E_circumflex 0xca +#define E_diaeresis 0xcb +#define I_grave 0xcc +#define I_acute 0xcd +#define I_circumflex 0xce +#define I_diaeresis 0xcf +#define N_virguilla 0xd1 +#define O_grave 0xd2 +#define O_acute 0xd3 +#define O_circumflex 0xd4 +#define O_virguilla 0xd5 +#define O_diaeresis 0xd6 +#define O_slash 0xd8 +#define U_grave 0xd9 +#define U_acute 0xda +#define U_circumflex 0xdb +#define U_diaeresis 0xdc +#define Y_acute 0xdd +#define a_grave 0xe0 +#define a_acute 0xe1 +#define a_circumflex 0xe2 +#define a_virguilla 0xe3 +#define a_diaeresis 0xe4 +#define a_ring 0xe5 +#define c_cedilla 0xe7 +#define e_grave 0xe8 +#define e_acute 0xe9 +#define e_circumflex 0xea +#define e_diaeresis 0xeb +#define i_grave 0xec +#define i_acute 0xed +#define i_circumflex 0xee +#define i_diaeresis 0xef +#define n_virguilla 0xf1 +#define o_grave 0xf2 +#define o_acute 0xf3 +#define o_circumflex 0xf4 +#define o_virguilla 0xf5 +#define o_diaeresis 0xf6 +#define o_slash 0xf8 +#define u_grave 0xf9 +#define u_acute 0xfa +#define u_circumflex 0xfb +#define u_diaeresis 0xfc +#define y_acute 0xfd +#define y_diaeresis 0xff switch (c) { - case 'A': case 0300: case 0301: case 0302: - case 0303: case 0304: case 0305: - CASEMBC(0x100) CASEMBC(0x102) CASEMBC(0x104) CASEMBC(0x1cd) - CASEMBC(0x1de) CASEMBC(0x1e0) CASEMBC(0x1ea2) - EMIT2('A'); EMIT2(0300); EMIT2(0301); EMIT2(0302); - EMIT2(0303); EMIT2(0304); EMIT2(0305); + case 'A': case A_grave: case A_acute: case A_circumflex: + case A_virguilla: case A_diaeresis: case A_ring: + CASEMBC(0x100) CASEMBC(0x102) CASEMBC(0x104) + CASEMBC(0x1cd) CASEMBC(0x1de) CASEMBC(0x1e0) + CASEMBC(0x1ea2) + EMIT2('A'); EMIT2(A_grave); EMIT2(A_acute); + EMIT2(A_circumflex); EMIT2(A_virguilla); + EMIT2(A_diaeresis); EMIT2(A_ring); EMITMBC(0x100) EMITMBC(0x102) EMITMBC(0x104) EMITMBC(0x1cd) EMITMBC(0x1de) EMITMBC(0x1e0) EMITMBC(0x1ea2) @@ -739,23 +796,24 @@ static void nfa_emit_equi_class(int c) EMIT2('B'); EMITMBC(0x1e02) EMITMBC(0x1e06) return; - case 'C': case 0307: - CASEMBC(0x106) CASEMBC(0x108) CASEMBC(0x10a) CASEMBC(0x10c) - EMIT2('C'); EMIT2(0307); EMITMBC(0x106) EMITMBC(0x108) + case 'C': case C_cedilla: CASEMBC(0x106) CASEMBC(0x108) CASEMBC(0x10a) + CASEMBC(0x10c) + EMIT2('C'); EMIT2(C_cedilla); EMITMBC(0x106) EMITMBC(0x108) EMITMBC(0x10a) EMITMBC(0x10c) return; case 'D': CASEMBC(0x10e) CASEMBC(0x110) CASEMBC(0x1e0a) - CASEMBC(0x1e0e) CASEMBC(0x1e10) + CASEMBC(0x1e0e) CASEMBC(0x1e10) EMIT2('D'); EMITMBC(0x10e) EMITMBC(0x110) EMITMBC(0x1e0a) EMITMBC(0x1e0e) EMITMBC(0x1e10) return; - case 'E': case 0310: case 0311: case 0312: case 0313: - CASEMBC(0x112) CASEMBC(0x114) CASEMBC(0x116) CASEMBC(0x118) - CASEMBC(0x11a) CASEMBC(0x1eba) CASEMBC(0x1ebc) - EMIT2('E'); EMIT2(0310); EMIT2(0311); EMIT2(0312); - EMIT2(0313); + case 'E': case E_grave: case E_acute: case E_circumflex: + case E_diaeresis: CASEMBC(0x112) CASEMBC(0x114) + CASEMBC(0x116) CASEMBC(0x118) CASEMBC(0x11a) + CASEMBC(0x1eba) CASEMBC(0x1ebc) + EMIT2('E'); EMIT2(E_grave); EMIT2(E_acute); + EMIT2(E_circumflex); EMIT2(E_diaeresis); EMITMBC(0x112) EMITMBC(0x114) EMITMBC(0x116) EMITMBC(0x118) EMITMBC(0x11a) EMITMBC(0x1eba) EMITMBC(0x1ebc) @@ -766,24 +824,26 @@ static void nfa_emit_equi_class(int c) return; case 'G': CASEMBC(0x11c) CASEMBC(0x11e) CASEMBC(0x120) - CASEMBC(0x122) CASEMBC(0x1e4) CASEMBC(0x1e6) CASEMBC(0x1f4) - CASEMBC(0x1e20) + CASEMBC(0x122) CASEMBC(0x1e4) CASEMBC(0x1e6) + CASEMBC(0x1f4) CASEMBC(0x1e20) EMIT2('G'); EMITMBC(0x11c) EMITMBC(0x11e) EMITMBC(0x120) EMITMBC(0x122) EMITMBC(0x1e4) EMITMBC(0x1e6) EMITMBC(0x1f4) EMITMBC(0x1e20) return; case 'H': CASEMBC(0x124) CASEMBC(0x126) CASEMBC(0x1e22) - CASEMBC(0x1e26) CASEMBC(0x1e28) + CASEMBC(0x1e26) CASEMBC(0x1e28) EMIT2('H'); EMITMBC(0x124) EMITMBC(0x126) EMITMBC(0x1e22) EMITMBC(0x1e26) EMITMBC(0x1e28) return; - case 'I': case 0314: case 0315: case 0316: case 0317: - CASEMBC(0x128) CASEMBC(0x12a) CASEMBC(0x12c) CASEMBC(0x12e) - CASEMBC(0x130) CASEMBC(0x1cf) CASEMBC(0x1ec8) - EMIT2('I'); EMIT2(0314); EMIT2(0315); EMIT2(0316); - EMIT2(0317); EMITMBC(0x128) EMITMBC(0x12a) + case 'I': case I_grave: case I_acute: case I_circumflex: + case I_diaeresis: CASEMBC(0x128) CASEMBC(0x12a) + CASEMBC(0x12c) CASEMBC(0x12e) CASEMBC(0x130) + CASEMBC(0x1cf) CASEMBC(0x1ec8) + EMIT2('I'); EMIT2(I_grave); EMIT2(I_acute); + EMIT2(I_circumflex); EMIT2(I_diaeresis); + EMITMBC(0x128) EMITMBC(0x12a) EMITMBC(0x12c) EMITMBC(0x12e) EMITMBC(0x130) EMITMBC(0x1cf) EMITMBC(0x1ec8) return; @@ -793,13 +853,13 @@ static void nfa_emit_equi_class(int c) return; case 'K': CASEMBC(0x136) CASEMBC(0x1e8) CASEMBC(0x1e30) - CASEMBC(0x1e34) + CASEMBC(0x1e34) EMIT2('K'); EMITMBC(0x136) EMITMBC(0x1e8) EMITMBC(0x1e30) EMITMBC(0x1e34) return; case 'L': CASEMBC(0x139) CASEMBC(0x13b) CASEMBC(0x13d) - CASEMBC(0x13f) CASEMBC(0x141) CASEMBC(0x1e3a) + CASEMBC(0x13f) CASEMBC(0x141) CASEMBC(0x1e3a) EMIT2('L'); EMITMBC(0x139) EMITMBC(0x13b) EMITMBC(0x13d) EMITMBC(0x13f) EMITMBC(0x141) EMITMBC(0x1e3a) return; @@ -808,19 +868,21 @@ static void nfa_emit_equi_class(int c) EMIT2('M'); EMITMBC(0x1e3e) EMITMBC(0x1e40) return; - case 'N': case 0321: - CASEMBC(0x143) CASEMBC(0x145) CASEMBC(0x147) CASEMBC(0x1e44) - CASEMBC(0x1e48) - EMIT2('N'); EMIT2(0321); EMITMBC(0x143) EMITMBC(0x145) + case 'N': case N_virguilla: CASEMBC(0x143) CASEMBC(0x145) + CASEMBC(0x147) CASEMBC(0x1e44) CASEMBC(0x1e48) + EMIT2('N'); EMIT2(N_virguilla); + EMITMBC(0x143) EMITMBC(0x145) EMITMBC(0x147) EMITMBC(0x1e44) EMITMBC(0x1e48) return; - case 'O': case 0322: case 0323: case 0324: case 0325: - case 0326: case 0330: - CASEMBC(0x14c) CASEMBC(0x14e) CASEMBC(0x150) CASEMBC(0x1a0) - CASEMBC(0x1d1) CASEMBC(0x1ea) CASEMBC(0x1ec) CASEMBC(0x1ece) - EMIT2('O'); EMIT2(0322); EMIT2(0323); EMIT2(0324); - EMIT2(0325); EMIT2(0326); EMIT2(0330); + case 'O': case O_grave: case O_acute: case O_circumflex: + case O_virguilla: case O_diaeresis: case O_slash: + CASEMBC(0x14c) CASEMBC(0x14e) CASEMBC(0x150) + CASEMBC(0x1a0) CASEMBC(0x1d1) CASEMBC(0x1ea) + CASEMBC(0x1ec) CASEMBC(0x1ece) + EMIT2('O'); EMIT2(O_grave); EMIT2(O_acute); + EMIT2(O_circumflex); EMIT2(O_virguilla); + EMIT2(O_diaeresis); EMIT2(O_slash); EMITMBC(0x14c) EMITMBC(0x14e) EMITMBC(0x150) EMITMBC(0x1a0) EMITMBC(0x1d1) EMITMBC(0x1ea) EMITMBC(0x1ec) EMITMBC(0x1ece) @@ -831,29 +893,31 @@ static void nfa_emit_equi_class(int c) return; case 'R': CASEMBC(0x154) CASEMBC(0x156) CASEMBC(0x158) - CASEMBC(0x1e58) CASEMBC(0x1e5e) + CASEMBC(0x1e58) CASEMBC(0x1e5e) EMIT2('R'); EMITMBC(0x154) EMITMBC(0x156) EMITMBC(0x158) EMITMBC(0x1e58) EMITMBC(0x1e5e) return; case 'S': CASEMBC(0x15a) CASEMBC(0x15c) CASEMBC(0x15e) - CASEMBC(0x160) CASEMBC(0x1e60) + CASEMBC(0x160) CASEMBC(0x1e60) EMIT2('S'); EMITMBC(0x15a) EMITMBC(0x15c) EMITMBC(0x15e) EMITMBC(0x160) EMITMBC(0x1e60) return; case 'T': CASEMBC(0x162) CASEMBC(0x164) CASEMBC(0x166) - CASEMBC(0x1e6a) CASEMBC(0x1e6e) + CASEMBC(0x1e6a) CASEMBC(0x1e6e) EMIT2('T'); EMITMBC(0x162) EMITMBC(0x164) EMITMBC(0x166) EMITMBC(0x1e6a) EMITMBC(0x1e6e) return; - case 'U': case 0331: case 0332: case 0333: case 0334: - CASEMBC(0x168) CASEMBC(0x16a) CASEMBC(0x16c) CASEMBC(0x16e) - CASEMBC(0x170) CASEMBC(0x172) CASEMBC(0x1af) CASEMBC(0x1d3) - CASEMBC(0x1ee6) - EMIT2('U'); EMIT2(0331); EMIT2(0332); EMIT2(0333); - EMIT2(0334); EMITMBC(0x168) EMITMBC(0x16a) + case 'U': case U_grave: case U_acute: case U_diaeresis: + case U_circumflex: CASEMBC(0x168) CASEMBC(0x16a) + CASEMBC(0x16c) CASEMBC(0x16e) CASEMBC(0x170) + CASEMBC(0x172) CASEMBC(0x1af) CASEMBC(0x1d3) + CASEMBC(0x1ee6) + EMIT2('U'); EMIT2(U_grave); EMIT2(U_acute); + EMIT2(U_diaeresis); EMIT2(U_circumflex); + EMITMBC(0x168) EMITMBC(0x16a) EMITMBC(0x16c) EMITMBC(0x16e) EMITMBC(0x170) EMITMBC(0x172) EMITMBC(0x1af) EMITMBC(0x1d3) EMITMBC(0x1ee6) @@ -864,7 +928,7 @@ static void nfa_emit_equi_class(int c) return; case 'W': CASEMBC(0x174) CASEMBC(0x1e80) CASEMBC(0x1e82) - CASEMBC(0x1e84) CASEMBC(0x1e86) + CASEMBC(0x1e84) CASEMBC(0x1e86) EMIT2('W'); EMITMBC(0x174) EMITMBC(0x1e80) EMITMBC(0x1e82) EMITMBC(0x1e84) EMITMBC(0x1e86) return; @@ -873,26 +937,29 @@ static void nfa_emit_equi_class(int c) EMIT2('X'); EMITMBC(0x1e8a) EMITMBC(0x1e8c) return; - case 'Y': case 0335: - CASEMBC(0x176) CASEMBC(0x178) CASEMBC(0x1e8e) CASEMBC(0x1ef2) - CASEMBC(0x1ef6) CASEMBC(0x1ef8) - EMIT2('Y'); EMIT2(0335); EMITMBC(0x176) EMITMBC(0x178) + case 'Y': case Y_acute: CASEMBC(0x176) CASEMBC(0x178) + CASEMBC(0x1e8e) CASEMBC(0x1ef2) CASEMBC(0x1ef6) + CASEMBC(0x1ef8) + EMIT2('Y'); EMIT2(Y_acute); + EMITMBC(0x176) EMITMBC(0x178) EMITMBC(0x1e8e) EMITMBC(0x1ef2) EMITMBC(0x1ef6) EMITMBC(0x1ef8) return; case 'Z': CASEMBC(0x179) CASEMBC(0x17b) CASEMBC(0x17d) - CASEMBC(0x1b5) CASEMBC(0x1e90) CASEMBC(0x1e94) + CASEMBC(0x1b5) CASEMBC(0x1e90) CASEMBC(0x1e94) EMIT2('Z'); EMITMBC(0x179) EMITMBC(0x17b) EMITMBC(0x17d) EMITMBC(0x1b5) EMITMBC(0x1e90) EMITMBC(0x1e94) return; - case 'a': case 0340: case 0341: case 0342: - case 0343: case 0344: case 0345: - CASEMBC(0x101) CASEMBC(0x103) CASEMBC(0x105) CASEMBC(0x1ce) - CASEMBC(0x1df) CASEMBC(0x1e1) CASEMBC(0x1ea3) - EMIT2('a'); EMIT2(0340); EMIT2(0341); EMIT2(0342); - EMIT2(0343); EMIT2(0344); EMIT2(0345); + case 'a': case a_grave: case a_acute: case a_circumflex: + case a_virguilla: case a_diaeresis: case a_ring: + CASEMBC(0x101) CASEMBC(0x103) CASEMBC(0x105) + CASEMBC(0x1ce) CASEMBC(0x1df) CASEMBC(0x1e1) + CASEMBC(0x1ea3) + EMIT2('a'); EMIT2(a_grave); EMIT2(a_acute); + EMIT2(a_circumflex); EMIT2(a_virguilla); + EMIT2(a_diaeresis); EMIT2(a_ring); EMITMBC(0x101) EMITMBC(0x103) EMITMBC(0x105) EMITMBC(0x1ce) EMITMBC(0x1df) EMITMBC(0x1e1) EMITMBC(0x1ea3) @@ -902,23 +969,26 @@ static void nfa_emit_equi_class(int c) EMIT2('b'); EMITMBC(0x1e03) EMITMBC(0x1e07) return; - case 'c': case 0347: - CASEMBC(0x107) CASEMBC(0x109) CASEMBC(0x10b) CASEMBC(0x10d) - EMIT2('c'); EMIT2(0347); EMITMBC(0x107) EMITMBC(0x109) + case 'c': case c_cedilla: CASEMBC(0x107) CASEMBC(0x109) + CASEMBC(0x10b) CASEMBC(0x10d) + EMIT2('c'); EMIT2(c_cedilla); + EMITMBC(0x107) EMITMBC(0x109) EMITMBC(0x10b) EMITMBC(0x10d) return; case 'd': CASEMBC(0x10f) CASEMBC(0x111) CASEMBC(0x1e0b) - CASEMBC(0x1e0f) CASEMBC(0x1e11) + CASEMBC(0x1e0f) CASEMBC(0x1e11) EMIT2('d'); EMITMBC(0x10f) EMITMBC(0x111) EMITMBC(0x1e0b) EMITMBC(0x1e0f) EMITMBC(0x1e11) return; - case 'e': case 0350: case 0351: case 0352: case 0353: - CASEMBC(0x113) CASEMBC(0x115) CASEMBC(0x117) CASEMBC(0x119) - CASEMBC(0x11b) CASEMBC(0x1ebb) CASEMBC(0x1ebd) - EMIT2('e'); EMIT2(0350); EMIT2(0351); EMIT2(0352); - EMIT2(0353); EMITMBC(0x113) EMITMBC(0x115) + case 'e': case e_grave: case e_acute: case e_circumflex: + case e_diaeresis: CASEMBC(0x113) CASEMBC(0x115) + CASEMBC(0x117) CASEMBC(0x119) CASEMBC(0x11b) + CASEMBC(0x1ebb) CASEMBC(0x1ebd) + EMIT2('e'); EMIT2(e_grave); EMIT2(e_acute); + EMIT2(e_circumflex); EMIT2(e_diaeresis); + EMITMBC(0x113) EMITMBC(0x115) EMITMBC(0x117) EMITMBC(0x119) EMITMBC(0x11b) EMITMBC(0x1ebb) EMITMBC(0x1ebd) return; @@ -928,24 +998,26 @@ static void nfa_emit_equi_class(int c) return; case 'g': CASEMBC(0x11d) CASEMBC(0x11f) CASEMBC(0x121) - CASEMBC(0x123) CASEMBC(0x1e5) CASEMBC(0x1e7) CASEMBC(0x1f5) - CASEMBC(0x1e21) + CASEMBC(0x123) CASEMBC(0x1e5) CASEMBC(0x1e7) + CASEMBC(0x1f5) CASEMBC(0x1e21) EMIT2('g'); EMITMBC(0x11d) EMITMBC(0x11f) EMITMBC(0x121) EMITMBC(0x123) EMITMBC(0x1e5) EMITMBC(0x1e7) EMITMBC(0x1f5) EMITMBC(0x1e21) return; case 'h': CASEMBC(0x125) CASEMBC(0x127) CASEMBC(0x1e23) - CASEMBC(0x1e27) CASEMBC(0x1e29) CASEMBC(0x1e96) + CASEMBC(0x1e27) CASEMBC(0x1e29) CASEMBC(0x1e96) EMIT2('h'); EMITMBC(0x125) EMITMBC(0x127) EMITMBC(0x1e23) EMITMBC(0x1e27) EMITMBC(0x1e29) EMITMBC(0x1e96) return; - case 'i': case 0354: case 0355: case 0356: case 0357: - CASEMBC(0x129) CASEMBC(0x12b) CASEMBC(0x12d) CASEMBC(0x12f) - CASEMBC(0x1d0) CASEMBC(0x1ec9) - EMIT2('i'); EMIT2(0354); EMIT2(0355); EMIT2(0356); - EMIT2(0357); EMITMBC(0x129) EMITMBC(0x12b) + case 'i': case i_grave: case i_acute: case i_circumflex: + case i_diaeresis: CASEMBC(0x129) CASEMBC(0x12b) + CASEMBC(0x12d) CASEMBC(0x12f) CASEMBC(0x1d0) + CASEMBC(0x1ec9) + EMIT2('i'); EMIT2(i_grave); EMIT2(i_acute); + EMIT2(i_circumflex); EMIT2(i_diaeresis); + EMITMBC(0x129) EMITMBC(0x12b) EMITMBC(0x12d) EMITMBC(0x12f) EMITMBC(0x1d0) EMITMBC(0x1ec9) return; @@ -955,13 +1027,13 @@ static void nfa_emit_equi_class(int c) return; case 'k': CASEMBC(0x137) CASEMBC(0x1e9) CASEMBC(0x1e31) - CASEMBC(0x1e35) + CASEMBC(0x1e35) EMIT2('k'); EMITMBC(0x137) EMITMBC(0x1e9) EMITMBC(0x1e31) EMITMBC(0x1e35) return; case 'l': CASEMBC(0x13a) CASEMBC(0x13c) CASEMBC(0x13e) - CASEMBC(0x140) CASEMBC(0x142) CASEMBC(0x1e3b) + CASEMBC(0x140) CASEMBC(0x142) CASEMBC(0x1e3b) EMIT2('l'); EMITMBC(0x13a) EMITMBC(0x13c) EMITMBC(0x13e) EMITMBC(0x140) EMITMBC(0x142) EMITMBC(0x1e3b) return; @@ -970,20 +1042,23 @@ static void nfa_emit_equi_class(int c) EMIT2('m'); EMITMBC(0x1e3f) EMITMBC(0x1e41) return; - case 'n': case 0361: - CASEMBC(0x144) CASEMBC(0x146) CASEMBC(0x148) CASEMBC(0x149) - CASEMBC(0x1e45) CASEMBC(0x1e49) - EMIT2('n'); EMIT2(0361); EMITMBC(0x144) EMITMBC(0x146) + case 'n': case n_virguilla: CASEMBC(0x144) CASEMBC(0x146) + CASEMBC(0x148) CASEMBC(0x149) CASEMBC(0x1e45) + CASEMBC(0x1e49) + EMIT2('n'); EMIT2(n_virguilla); + EMITMBC(0x144) EMITMBC(0x146) EMITMBC(0x148) EMITMBC(0x149) EMITMBC(0x1e45) EMITMBC(0x1e49) return; - case 'o': case 0362: case 0363: case 0364: case 0365: - case 0366: case 0370: - CASEMBC(0x14d) CASEMBC(0x14f) CASEMBC(0x151) CASEMBC(0x1a1) - CASEMBC(0x1d2) CASEMBC(0x1eb) CASEMBC(0x1ed) CASEMBC(0x1ecf) - EMIT2('o'); EMIT2(0362); EMIT2(0363); EMIT2(0364); - EMIT2(0365); EMIT2(0366); EMIT2(0370); + case 'o': case o_grave: case o_acute: case o_circumflex: + case o_virguilla: case o_diaeresis: case o_slash: + CASEMBC(0x14d) CASEMBC(0x14f) CASEMBC(0x151) + CASEMBC(0x1a1) CASEMBC(0x1d2) CASEMBC(0x1eb) + CASEMBC(0x1ed) CASEMBC(0x1ecf) + EMIT2('o'); EMIT2(o_grave); EMIT2(o_acute); + EMIT2(o_circumflex); EMIT2(o_virguilla); + EMIT2(o_diaeresis); EMIT2(o_slash); EMITMBC(0x14d) EMITMBC(0x14f) EMITMBC(0x151) EMITMBC(0x1a1) EMITMBC(0x1d2) EMITMBC(0x1eb) EMITMBC(0x1ed) EMITMBC(0x1ecf) @@ -994,29 +1069,31 @@ static void nfa_emit_equi_class(int c) return; case 'r': CASEMBC(0x155) CASEMBC(0x157) CASEMBC(0x159) - CASEMBC(0x1e59) CASEMBC(0x1e5f) + CASEMBC(0x1e59) CASEMBC(0x1e5f) EMIT2('r'); EMITMBC(0x155) EMITMBC(0x157) EMITMBC(0x159) EMITMBC(0x1e59) EMITMBC(0x1e5f) return; case 's': CASEMBC(0x15b) CASEMBC(0x15d) CASEMBC(0x15f) - CASEMBC(0x161) CASEMBC(0x1e61) + CASEMBC(0x161) CASEMBC(0x1e61) EMIT2('s'); EMITMBC(0x15b) EMITMBC(0x15d) EMITMBC(0x15f) EMITMBC(0x161) EMITMBC(0x1e61) return; case 't': CASEMBC(0x163) CASEMBC(0x165) CASEMBC(0x167) - CASEMBC(0x1e6b) CASEMBC(0x1e6f) CASEMBC(0x1e97) + CASEMBC(0x1e6b) CASEMBC(0x1e6f) CASEMBC(0x1e97) EMIT2('t'); EMITMBC(0x163) EMITMBC(0x165) EMITMBC(0x167) EMITMBC(0x1e6b) EMITMBC(0x1e6f) EMITMBC(0x1e97) return; - case 'u': case 0371: case 0372: case 0373: case 0374: - CASEMBC(0x169) CASEMBC(0x16b) CASEMBC(0x16d) CASEMBC(0x16f) - CASEMBC(0x171) CASEMBC(0x173) CASEMBC(0x1b0) CASEMBC(0x1d4) - CASEMBC(0x1ee7) - EMIT2('u'); EMIT2(0371); EMIT2(0372); EMIT2(0373); - EMIT2(0374); EMITMBC(0x169) EMITMBC(0x16b) + case 'u': case u_grave: case u_acute: case u_circumflex: + case u_diaeresis: CASEMBC(0x169) CASEMBC(0x16b) + CASEMBC(0x16d) CASEMBC(0x16f) CASEMBC(0x171) + CASEMBC(0x173) CASEMBC(0x1b0) CASEMBC(0x1d4) + CASEMBC(0x1ee7) + EMIT2('u'); EMIT2(u_grave); EMIT2(u_acute); + EMIT2(u_circumflex); EMIT2(u_diaeresis); + EMITMBC(0x169) EMITMBC(0x16b) EMITMBC(0x16d) EMITMBC(0x16f) EMITMBC(0x171) EMITMBC(0x173) EMITMBC(0x1b0) EMITMBC(0x1d4) EMITMBC(0x1ee7) @@ -1027,7 +1104,7 @@ static void nfa_emit_equi_class(int c) return; case 'w': CASEMBC(0x175) CASEMBC(0x1e81) CASEMBC(0x1e83) - CASEMBC(0x1e85) CASEMBC(0x1e87) CASEMBC(0x1e98) + CASEMBC(0x1e85) CASEMBC(0x1e87) CASEMBC(0x1e98) EMIT2('w'); EMITMBC(0x175) EMITMBC(0x1e81) EMITMBC(0x1e83) EMITMBC(0x1e85) EMITMBC(0x1e87) EMITMBC(0x1e98) return; @@ -1036,16 +1113,17 @@ static void nfa_emit_equi_class(int c) EMIT2('x'); EMITMBC(0x1e8b) EMITMBC(0x1e8d) return; - case 'y': case 0375: case 0377: - CASEMBC(0x177) CASEMBC(0x1e8f) CASEMBC(0x1e99) - CASEMBC(0x1ef3) CASEMBC(0x1ef7) CASEMBC(0x1ef9) - EMIT2('y'); EMIT2(0375); EMIT2(0377); EMITMBC(0x177) + case 'y': case y_acute: case y_diaeresis: CASEMBC(0x177) + CASEMBC(0x1e8f) CASEMBC(0x1e99) CASEMBC(0x1ef3) + CASEMBC(0x1ef7) CASEMBC(0x1ef9) + EMIT2('y'); EMIT2(y_acute); EMIT2(y_diaeresis); + EMITMBC(0x177) EMITMBC(0x1e8f) EMITMBC(0x1e99) EMITMBC(0x1ef3) EMITMBC(0x1ef7) EMITMBC(0x1ef9) return; case 'z': CASEMBC(0x17a) CASEMBC(0x17c) CASEMBC(0x17e) - CASEMBC(0x1b6) CASEMBC(0x1e91) CASEMBC(0x1e95) + CASEMBC(0x1b6) CASEMBC(0x1e91) CASEMBC(0x1e95) EMIT2('z'); EMITMBC(0x17a) EMITMBC(0x17c) EMITMBC(0x17e) EMITMBC(0x1b6) EMITMBC(0x1e91) EMITMBC(0x1e95) return; diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 9075f94a20..50517d2829 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2592,11 +2592,13 @@ win_line ( shl->startcol = MAXCOL; shl->endcol = MAXCOL; shl->attr_cur = 0; + shl->is_addpos = false; v = (long)(ptr - line); if (cur != NULL) { cur->pos.cur = 0; } - next_search_hl(wp, shl, lnum, (colnr_T)v, cur); + next_search_hl(wp, shl, lnum, (colnr_T)v, + shl == &search_hl ? NULL : cur); // Need to get the line again, a multi-line regexp may have made it // invalid. @@ -2925,7 +2927,8 @@ win_line ( shl->attr_cur = 0; prev_syntax_id = 0; - next_search_hl(wp, shl, lnum, (colnr_T)v, cur); + next_search_hl(wp, shl, lnum, (colnr_T)v, + shl == &search_hl ? NULL : cur); pos_inprogress = !(cur == NULL || cur->pos.cur == 0); /* Need to get the line again, a multi-line regexp @@ -3760,18 +3763,18 @@ win_line ( if ((long)(wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol) ++prevcol; - /* Invert at least one char, used for Visual and empty line or - * highlight match at end of line. If it's beyond the last - * char on the screen, just overwrite that one (tricky!) Not - * needed when a '$' was displayed for 'list'. */ - prevcol_hl_flag = FALSE; - if (prevcol == (long)search_hl.startcol) - prevcol_hl_flag = TRUE; - else { + // Invert at least one char, used for Visual and empty line or + // highlight match at end of line. If it's beyond the last + // char on the screen, just overwrite that one (tricky!) Not + // needed when a '$' was displayed for 'list'. + prevcol_hl_flag = false; + if (!search_hl.is_addpos && prevcol == (long)search_hl.startcol) { + prevcol_hl_flag = true; + } else { cur = wp->w_match_head; while (cur != NULL) { - if (prevcol == (long)cur->hl.startcol) { - prevcol_hl_flag = TRUE; + if (!cur->hl.is_addpos && prevcol == (long)cur->hl.startcol) { + prevcol_hl_flag = true; break; } cur = cur->next; @@ -3821,10 +3824,13 @@ win_line ( shl_flag = TRUE; } else shl = &cur->hl; - if ((ptr - line) - 1 == (long)shl->startcol) + if ((ptr - line) - 1 == (long)shl->startcol + && (shl == &search_hl || !shl->is_addpos)) { char_attr = shl->attr; - if (shl != &search_hl && cur != NULL) + } + if (shl != &search_hl && cur != NULL) { cur = cur->next; + } } } ScreenAttrs[off] = char_attr; @@ -5557,8 +5563,9 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum) // in progress n = 0; while (shl->first_lnum < lnum && (shl->rm.regprog != NULL - || (cur != NULL && pos_inprogress))) { - next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, cur); + || (cur != NULL && pos_inprogress))) { + next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, + shl == &search_hl ? NULL : cur); pos_inprogress = !(cur == NULL || cur->pos.cur == 0); if (shl->lnum != 0) { shl->first_lnum = shl->lnum @@ -5691,6 +5698,8 @@ next_search_hl ( } } +/// If there is a match fill "shl" and return one. +/// Return zero otherwise. static int next_search_hl_pos( match_T *shl, // points to a match @@ -5700,47 +5709,50 @@ next_search_hl_pos( ) { int i; - int bot = -1; + int found = -1; shl->lnum = 0; for (i = posmatch->cur; i < MAXPOSMATCH; i++) { - if (posmatch->pos[i].lnum == 0) { + llpos_T *pos = &posmatch->pos[i]; + + if (pos->lnum == 0) { break; } - if (posmatch->pos[i].col < mincol) { + if (pos->len == 0 && pos->col < mincol) { continue; } - if (posmatch->pos[i].lnum == lnum) { - if (bot != -1) { - // partially sort positions by column numbers - // on the same line - if (posmatch->pos[i].col < posmatch->pos[bot].col) { - llpos_T tmp = posmatch->pos[i]; + if (pos->lnum == lnum) { + if (found >= 0) { + // if this match comes before the one at "found" then swap + // them + if (pos->col < posmatch->pos[found].col) { + llpos_T tmp = *pos; - posmatch->pos[i] = posmatch->pos[bot]; - posmatch->pos[bot] = tmp; + *pos = posmatch->pos[found]; + posmatch->pos[found] = tmp; } } else { - bot = i; - shl->lnum = lnum; + found = i; } } } posmatch->cur = 0; - if (bot != -1) { - colnr_T start = posmatch->pos[bot].col == 0 - ? 0: posmatch->pos[bot].col - 1; - colnr_T end = posmatch->pos[bot].col == 0 - ? MAXCOL : start + posmatch->pos[bot].len; + if (found >= 0) { + colnr_T start = posmatch->pos[found].col == 0 + ? 0: posmatch->pos[found].col - 1; + colnr_T end = posmatch->pos[found].col == 0 + ? MAXCOL : start + posmatch->pos[found].len; + shl->lnum = lnum; shl->rm.startpos[0].lnum = 0; shl->rm.startpos[0].col = start; shl->rm.endpos[0].lnum = 0; shl->rm.endpos[0].col = end; - posmatch->cur = bot + 1; - return true; + shl->is_addpos = true; + posmatch->cur = found + 1; + return 1; } - return false; + return 0; } static void screen_start_highlight(int attr) diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index cd37bde3cb..aded08faee 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -7547,175 +7547,687 @@ char_u *get_highlight_name(expand_T *xp, int idx) } 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}, + // Colors from rgb.txt + { "AliceBlue", RGB(0xf0, 0xf8, 0xff) }, + { "AntiqueWhite", RGB(0xfa, 0xeb, 0xd7) }, + { "AntiqueWhite1", RGB(0xff, 0xef, 0xdb) }, + { "AntiqueWhite2", RGB(0xee, 0xdf, 0xcc) }, + { "AntiqueWhite3", RGB(0xcd, 0xc0, 0xb0) }, + { "AntiqueWhite4", RGB(0x8b, 0x83, 0x78) }, + { "Aqua", RGB(0x00, 0xff, 0xff) }, + { "Aquamarine", RGB(0x7f, 0xff, 0xd4) }, + { "Aquamarine1", RGB(0x7f, 0xff, 0xd4) }, + { "Aquamarine2", RGB(0x76, 0xee, 0xc6) }, + { "Aquamarine3", RGB(0x66, 0xcd, 0xaa) }, + { "Aquamarine4", RGB(0x45, 0x8b, 0x74) }, + { "Azure", RGB(0xf0, 0xff, 0xff) }, + { "Azure1", RGB(0xf0, 0xff, 0xff) }, + { "Azure2", RGB(0xe0, 0xee, 0xee) }, + { "Azure3", RGB(0xc1, 0xcd, 0xcd) }, + { "Azure4", RGB(0x83, 0x8b, 0x8b) }, + { "Beige", RGB(0xf5, 0xf5, 0xdc) }, + { "Bisque", RGB(0xff, 0xe4, 0xc4) }, + { "Bisque1", RGB(0xff, 0xe4, 0xc4) }, + { "Bisque2", RGB(0xee, 0xd5, 0xb7) }, + { "Bisque3", RGB(0xcd, 0xb7, 0x9e) }, + { "Bisque4", RGB(0x8b, 0x7d, 0x6b) }, + { "Black", RGB(0x00, 0x00, 0x00) }, + { "BlanchedAlmond", RGB(0xff, 0xeb, 0xcd) }, + { "Blue", RGB(0x00, 0x00, 0xff) }, + { "Blue1", RGB(0x0, 0x0, 0xff) }, + { "Blue2", RGB(0x0, 0x0, 0xee) }, + { "Blue3", RGB(0x0, 0x0, 0xcd) }, + { "Blue4", RGB(0x0, 0x0, 0x8b) }, + { "BlueViolet", RGB(0x8a, 0x2b, 0xe2) }, + { "Brown", RGB(0xa5, 0x2a, 0x2a) }, + { "Brown1", RGB(0xff, 0x40, 0x40) }, + { "Brown2", RGB(0xee, 0x3b, 0x3b) }, + { "Brown3", RGB(0xcd, 0x33, 0x33) }, + { "Brown4", RGB(0x8b, 0x23, 0x23) }, + { "BurlyWood", RGB(0xde, 0xb8, 0x87) }, + { "Burlywood1", RGB(0xff, 0xd3, 0x9b) }, + { "Burlywood2", RGB(0xee, 0xc5, 0x91) }, + { "Burlywood3", RGB(0xcd, 0xaa, 0x7d) }, + { "Burlywood4", RGB(0x8b, 0x73, 0x55) }, + { "CadetBlue", RGB(0x5f, 0x9e, 0xa0) }, + { "CadetBlue1", RGB(0x98, 0xf5, 0xff) }, + { "CadetBlue2", RGB(0x8e, 0xe5, 0xee) }, + { "CadetBlue3", RGB(0x7a, 0xc5, 0xcd) }, + { "CadetBlue4", RGB(0x53, 0x86, 0x8b) }, + { "ChartReuse", RGB(0x7f, 0xff, 0x00) }, + { "Chartreuse1", RGB(0x7f, 0xff, 0x0) }, + { "Chartreuse2", RGB(0x76, 0xee, 0x0) }, + { "Chartreuse3", RGB(0x66, 0xcd, 0x0) }, + { "Chartreuse4", RGB(0x45, 0x8b, 0x0) }, + { "Chocolate", RGB(0xd2, 0x69, 0x1e) }, + { "Chocolate1", RGB(0xff, 0x7f, 0x24) }, + { "Chocolate2", RGB(0xee, 0x76, 0x21) }, + { "Chocolate3", RGB(0xcd, 0x66, 0x1d) }, + { "Chocolate4", RGB(0x8b, 0x45, 0x13) }, + { "Coral", RGB(0xff, 0x7f, 0x50) }, + { "Coral1", RGB(0xff, 0x72, 0x56) }, + { "Coral2", RGB(0xee, 0x6a, 0x50) }, + { "Coral3", RGB(0xcd, 0x5b, 0x45) }, + { "Coral4", RGB(0x8b, 0x3e, 0x2f) }, + { "CornFlowerBlue", RGB(0x64, 0x95, 0xed) }, + { "Cornsilk", RGB(0xff, 0xf8, 0xdc) }, + { "Cornsilk1", RGB(0xff, 0xf8, 0xdc) }, + { "Cornsilk2", RGB(0xee, 0xe8, 0xcd) }, + { "Cornsilk3", RGB(0xcd, 0xc8, 0xb1) }, + { "Cornsilk4", RGB(0x8b, 0x88, 0x78) }, + { "Crimson", RGB(0xdc, 0x14, 0x3c) }, + { "Cyan", RGB(0x00, 0xff, 0xff) }, + { "Cyan1", RGB(0x0, 0xff, 0xff) }, + { "Cyan2", RGB(0x0, 0xee, 0xee) }, + { "Cyan3", RGB(0x0, 0xcd, 0xcd) }, + { "Cyan4", RGB(0x0, 0x8b, 0x8b) }, + { "DarkBlue", RGB(0x00, 0x00, 0x8b) }, + { "DarkCyan", RGB(0x00, 0x8b, 0x8b) }, + { "DarkGoldenRod", RGB(0xb8, 0x86, 0x0b) }, + { "DarkGoldenrod1", RGB(0xff, 0xb9, 0xf) }, + { "DarkGoldenrod2", RGB(0xee, 0xad, 0xe) }, + { "DarkGoldenrod3", RGB(0xcd, 0x95, 0xc) }, + { "DarkGoldenrod4", RGB(0x8b, 0x65, 0x8) }, + { "DarkGray", RGB(0xa9, 0xa9, 0xa9) }, + { "DarkGreen", RGB(0x00, 0x64, 0x00) }, + { "DarkGrey", RGB(0xa9, 0xa9, 0xa9) }, + { "DarkKhaki", RGB(0xbd, 0xb7, 0x6b) }, + { "DarkMagenta", RGB(0x8b, 0x00, 0x8b) }, + { "DarkOliveGreen", RGB(0x55, 0x6b, 0x2f) }, + { "DarkOliveGreen1", RGB(0xca, 0xff, 0x70) }, + { "DarkOliveGreen2", RGB(0xbc, 0xee, 0x68) }, + { "DarkOliveGreen3", RGB(0xa2, 0xcd, 0x5a) }, + { "DarkOliveGreen4", RGB(0x6e, 0x8b, 0x3d) }, + { "DarkOrange", RGB(0xff, 0x8c, 0x00) }, + { "DarkOrange1", RGB(0xff, 0x7f, 0x0) }, + { "DarkOrange2", RGB(0xee, 0x76, 0x0) }, + { "DarkOrange3", RGB(0xcd, 0x66, 0x0) }, + { "DarkOrange4", RGB(0x8b, 0x45, 0x0) }, + { "DarkOrchid", RGB(0x99, 0x32, 0xcc) }, + { "DarkOrchid1", RGB(0xbf, 0x3e, 0xff) }, + { "DarkOrchid2", RGB(0xb2, 0x3a, 0xee) }, + { "DarkOrchid3", RGB(0x9a, 0x32, 0xcd) }, + { "DarkOrchid4", RGB(0x68, 0x22, 0x8b) }, + { "DarkRed", RGB(0x8b, 0x00, 0x00) }, + { "DarkSalmon", RGB(0xe9, 0x96, 0x7a) }, + { "DarkSeaGreen", RGB(0x8f, 0xbc, 0x8f) }, + { "DarkSeaGreen1", RGB(0xc1, 0xff, 0xc1) }, + { "DarkSeaGreen2", RGB(0xb4, 0xee, 0xb4) }, + { "DarkSeaGreen3", RGB(0x9b, 0xcd, 0x9b) }, + { "DarkSeaGreen4", RGB(0x69, 0x8b, 0x69) }, + { "DarkSlateBlue", RGB(0x48, 0x3d, 0x8b) }, + { "DarkSlateGray", RGB(0x2f, 0x4f, 0x4f) }, + { "DarkSlateGray1", RGB(0x97, 0xff, 0xff) }, + { "DarkSlateGray2", RGB(0x8d, 0xee, 0xee) }, + { "DarkSlateGray3", RGB(0x79, 0xcd, 0xcd) }, + { "DarkSlateGray4", RGB(0x52, 0x8b, 0x8b) }, + { "DarkSlateGrey", RGB(0x2f, 0x4f, 0x4f) }, + { "DarkTurquoise", RGB(0x00, 0xce, 0xd1) }, + { "DarkViolet", RGB(0x94, 0x00, 0xd3) }, + { "DarkYellow", RGB(0xbb, 0xbb, 0x00) }, + { "DeepPink", RGB(0xff, 0x14, 0x93) }, + { "DeepPink1", RGB(0xff, 0x14, 0x93) }, + { "DeepPink2", RGB(0xee, 0x12, 0x89) }, + { "DeepPink3", RGB(0xcd, 0x10, 0x76) }, + { "DeepPink4", RGB(0x8b, 0xa, 0x50) }, + { "DeepSkyBlue", RGB(0x00, 0xbf, 0xff) }, + { "DeepSkyBlue1", RGB(0x0, 0xbf, 0xff) }, + { "DeepSkyBlue2", RGB(0x0, 0xb2, 0xee) }, + { "DeepSkyBlue3", RGB(0x0, 0x9a, 0xcd) }, + { "DeepSkyBlue4", RGB(0x0, 0x68, 0x8b) }, + { "DimGray", RGB(0x69, 0x69, 0x69) }, + { "DimGrey", RGB(0x69, 0x69, 0x69) }, + { "DodgerBlue", RGB(0x1e, 0x90, 0xff) }, + { "DodgerBlue1", RGB(0x1e, 0x90, 0xff) }, + { "DodgerBlue2", RGB(0x1c, 0x86, 0xee) }, + { "DodgerBlue3", RGB(0x18, 0x74, 0xcd) }, + { "DodgerBlue4", RGB(0x10, 0x4e, 0x8b) }, + { "Firebrick", RGB(0xb2, 0x22, 0x22) }, + { "Firebrick1", RGB(0xff, 0x30, 0x30) }, + { "Firebrick2", RGB(0xee, 0x2c, 0x2c) }, + { "Firebrick3", RGB(0xcd, 0x26, 0x26) }, + { "Firebrick4", RGB(0x8b, 0x1a, 0x1a) }, + { "FloralWhite", RGB(0xff, 0xfa, 0xf0) }, + { "ForestGreen", RGB(0x22, 0x8b, 0x22) }, + { "Fuchsia", RGB(0xff, 0x00, 0xff) }, + { "Gainsboro", RGB(0xdc, 0xdc, 0xdc) }, + { "GhostWhite", RGB(0xf8, 0xf8, 0xff) }, + { "Gold", RGB(0xff, 0xd7, 0x00) }, + { "Gold1", RGB(0xff, 0xd7, 0x0) }, + { "Gold2", RGB(0xee, 0xc9, 0x0) }, + { "Gold3", RGB(0xcd, 0xad, 0x0) }, + { "Gold4", RGB(0x8b, 0x75, 0x0) }, + { "GoldenRod", RGB(0xda, 0xa5, 0x20) }, + { "Goldenrod1", RGB(0xff, 0xc1, 0x25) }, + { "Goldenrod2", RGB(0xee, 0xb4, 0x22) }, + { "Goldenrod3", RGB(0xcd, 0x9b, 0x1d) }, + { "Goldenrod4", RGB(0x8b, 0x69, 0x14) }, + { "Gray", RGB(0x80, 0x80, 0x80) }, + { "Gray0", RGB(0x0, 0x0, 0x0) }, + { "Gray1", RGB(0x3, 0x3, 0x3) }, + { "Gray10", RGB(0x1a, 0x1a, 0x1a) }, + { "Gray100", RGB(0xff, 0xff, 0xff) }, + { "Gray11", RGB(0x1c, 0x1c, 0x1c) }, + { "Gray12", RGB(0x1f, 0x1f, 0x1f) }, + { "Gray13", RGB(0x21, 0x21, 0x21) }, + { "Gray14", RGB(0x24, 0x24, 0x24) }, + { "Gray15", RGB(0x26, 0x26, 0x26) }, + { "Gray16", RGB(0x29, 0x29, 0x29) }, + { "Gray17", RGB(0x2b, 0x2b, 0x2b) }, + { "Gray18", RGB(0x2e, 0x2e, 0x2e) }, + { "Gray19", RGB(0x30, 0x30, 0x30) }, + { "Gray2", RGB(0x5, 0x5, 0x5) }, + { "Gray20", RGB(0x33, 0x33, 0x33) }, + { "Gray21", RGB(0x36, 0x36, 0x36) }, + { "Gray22", RGB(0x38, 0x38, 0x38) }, + { "Gray23", RGB(0x3b, 0x3b, 0x3b) }, + { "Gray24", RGB(0x3d, 0x3d, 0x3d) }, + { "Gray25", RGB(0x40, 0x40, 0x40) }, + { "Gray26", RGB(0x42, 0x42, 0x42) }, + { "Gray27", RGB(0x45, 0x45, 0x45) }, + { "Gray28", RGB(0x47, 0x47, 0x47) }, + { "Gray29", RGB(0x4a, 0x4a, 0x4a) }, + { "Gray3", RGB(0x8, 0x8, 0x8) }, + { "Gray30", RGB(0x4d, 0x4d, 0x4d) }, + { "Gray31", RGB(0x4f, 0x4f, 0x4f) }, + { "Gray32", RGB(0x52, 0x52, 0x52) }, + { "Gray33", RGB(0x54, 0x54, 0x54) }, + { "Gray34", RGB(0x57, 0x57, 0x57) }, + { "Gray35", RGB(0x59, 0x59, 0x59) }, + { "Gray36", RGB(0x5c, 0x5c, 0x5c) }, + { "Gray37", RGB(0x5e, 0x5e, 0x5e) }, + { "Gray38", RGB(0x61, 0x61, 0x61) }, + { "Gray39", RGB(0x63, 0x63, 0x63) }, + { "Gray4", RGB(0xa, 0xa, 0xa) }, + { "Gray40", RGB(0x66, 0x66, 0x66) }, + { "Gray41", RGB(0x69, 0x69, 0x69) }, + { "Gray42", RGB(0x6b, 0x6b, 0x6b) }, + { "Gray43", RGB(0x6e, 0x6e, 0x6e) }, + { "Gray44", RGB(0x70, 0x70, 0x70) }, + { "Gray45", RGB(0x73, 0x73, 0x73) }, + { "Gray46", RGB(0x75, 0x75, 0x75) }, + { "Gray47", RGB(0x78, 0x78, 0x78) }, + { "Gray48", RGB(0x7a, 0x7a, 0x7a) }, + { "Gray49", RGB(0x7d, 0x7d, 0x7d) }, + { "Gray5", RGB(0xd, 0xd, 0xd) }, + { "Gray50", RGB(0x7f, 0x7f, 0x7f) }, + { "Gray51", RGB(0x82, 0x82, 0x82) }, + { "Gray52", RGB(0x85, 0x85, 0x85) }, + { "Gray53", RGB(0x87, 0x87, 0x87) }, + { "Gray54", RGB(0x8a, 0x8a, 0x8a) }, + { "Gray55", RGB(0x8c, 0x8c, 0x8c) }, + { "Gray56", RGB(0x8f, 0x8f, 0x8f) }, + { "Gray57", RGB(0x91, 0x91, 0x91) }, + { "Gray58", RGB(0x94, 0x94, 0x94) }, + { "Gray59", RGB(0x96, 0x96, 0x96) }, + { "Gray6", RGB(0xf, 0xf, 0xf) }, + { "Gray60", RGB(0x99, 0x99, 0x99) }, + { "Gray61", RGB(0x9c, 0x9c, 0x9c) }, + { "Gray62", RGB(0x9e, 0x9e, 0x9e) }, + { "Gray63", RGB(0xa1, 0xa1, 0xa1) }, + { "Gray64", RGB(0xa3, 0xa3, 0xa3) }, + { "Gray65", RGB(0xa6, 0xa6, 0xa6) }, + { "Gray66", RGB(0xa8, 0xa8, 0xa8) }, + { "Gray67", RGB(0xab, 0xab, 0xab) }, + { "Gray68", RGB(0xad, 0xad, 0xad) }, + { "Gray69", RGB(0xb0, 0xb0, 0xb0) }, + { "Gray7", RGB(0x12, 0x12, 0x12) }, + { "Gray70", RGB(0xb3, 0xb3, 0xb3) }, + { "Gray71", RGB(0xb5, 0xb5, 0xb5) }, + { "Gray72", RGB(0xb8, 0xb8, 0xb8) }, + { "Gray73", RGB(0xba, 0xba, 0xba) }, + { "Gray74", RGB(0xbd, 0xbd, 0xbd) }, + { "Gray75", RGB(0xbf, 0xbf, 0xbf) }, + { "Gray76", RGB(0xc2, 0xc2, 0xc2) }, + { "Gray77", RGB(0xc4, 0xc4, 0xc4) }, + { "Gray78", RGB(0xc7, 0xc7, 0xc7) }, + { "Gray79", RGB(0xc9, 0xc9, 0xc9) }, + { "Gray8", RGB(0x14, 0x14, 0x14) }, + { "Gray80", RGB(0xcc, 0xcc, 0xcc) }, + { "Gray81", RGB(0xcf, 0xcf, 0xcf) }, + { "Gray82", RGB(0xd1, 0xd1, 0xd1) }, + { "Gray83", RGB(0xd4, 0xd4, 0xd4) }, + { "Gray84", RGB(0xd6, 0xd6, 0xd6) }, + { "Gray85", RGB(0xd9, 0xd9, 0xd9) }, + { "Gray86", RGB(0xdb, 0xdb, 0xdb) }, + { "Gray87", RGB(0xde, 0xde, 0xde) }, + { "Gray88", RGB(0xe0, 0xe0, 0xe0) }, + { "Gray89", RGB(0xe3, 0xe3, 0xe3) }, + { "Gray9", RGB(0x17, 0x17, 0x17) }, + { "Gray90", RGB(0xe5, 0xe5, 0xe5) }, + { "Gray91", RGB(0xe8, 0xe8, 0xe8) }, + { "Gray92", RGB(0xeb, 0xeb, 0xeb) }, + { "Gray93", RGB(0xed, 0xed, 0xed) }, + { "Gray94", RGB(0xf0, 0xf0, 0xf0) }, + { "Gray95", RGB(0xf2, 0xf2, 0xf2) }, + { "Gray96", RGB(0xf5, 0xf5, 0xf5) }, + { "Gray97", RGB(0xf7, 0xf7, 0xf7) }, + { "Gray98", RGB(0xfa, 0xfa, 0xfa) }, + { "Gray99", RGB(0xfc, 0xfc, 0xfc) }, + { "Green", RGB(0x00, 0x80, 0x00) }, + { "Green1", RGB(0x0, 0xff, 0x0) }, + { "Green2", RGB(0x0, 0xee, 0x0) }, + { "Green3", RGB(0x0, 0xcd, 0x0) }, + { "Green4", RGB(0x0, 0x8b, 0x0) }, + { "GreenYellow", RGB(0xad, 0xff, 0x2f) }, + { "Grey", RGB(0x80, 0x80, 0x80) }, + { "Grey0", RGB(0x0, 0x0, 0x0) }, + { "Grey1", RGB(0x3, 0x3, 0x3) }, + { "Grey10", RGB(0x1a, 0x1a, 0x1a) }, + { "Grey100", RGB(0xff, 0xff, 0xff) }, + { "Grey11", RGB(0x1c, 0x1c, 0x1c) }, + { "Grey12", RGB(0x1f, 0x1f, 0x1f) }, + { "Grey13", RGB(0x21, 0x21, 0x21) }, + { "Grey14", RGB(0x24, 0x24, 0x24) }, + { "Grey15", RGB(0x26, 0x26, 0x26) }, + { "Grey16", RGB(0x29, 0x29, 0x29) }, + { "Grey17", RGB(0x2b, 0x2b, 0x2b) }, + { "Grey18", RGB(0x2e, 0x2e, 0x2e) }, + { "Grey19", RGB(0x30, 0x30, 0x30) }, + { "Grey2", RGB(0x5, 0x5, 0x5) }, + { "Grey20", RGB(0x33, 0x33, 0x33) }, + { "Grey21", RGB(0x36, 0x36, 0x36) }, + { "Grey22", RGB(0x38, 0x38, 0x38) }, + { "Grey23", RGB(0x3b, 0x3b, 0x3b) }, + { "Grey24", RGB(0x3d, 0x3d, 0x3d) }, + { "Grey25", RGB(0x40, 0x40, 0x40) }, + { "Grey26", RGB(0x42, 0x42, 0x42) }, + { "Grey27", RGB(0x45, 0x45, 0x45) }, + { "Grey28", RGB(0x47, 0x47, 0x47) }, + { "Grey29", RGB(0x4a, 0x4a, 0x4a) }, + { "Grey3", RGB(0x8, 0x8, 0x8) }, + { "Grey30", RGB(0x4d, 0x4d, 0x4d) }, + { "Grey31", RGB(0x4f, 0x4f, 0x4f) }, + { "Grey32", RGB(0x52, 0x52, 0x52) }, + { "Grey33", RGB(0x54, 0x54, 0x54) }, + { "Grey34", RGB(0x57, 0x57, 0x57) }, + { "Grey35", RGB(0x59, 0x59, 0x59) }, + { "Grey36", RGB(0x5c, 0x5c, 0x5c) }, + { "Grey37", RGB(0x5e, 0x5e, 0x5e) }, + { "Grey38", RGB(0x61, 0x61, 0x61) }, + { "Grey39", RGB(0x63, 0x63, 0x63) }, + { "Grey4", RGB(0xa, 0xa, 0xa) }, + { "Grey40", RGB(0x66, 0x66, 0x66) }, + { "Grey41", RGB(0x69, 0x69, 0x69) }, + { "Grey42", RGB(0x6b, 0x6b, 0x6b) }, + { "Grey43", RGB(0x6e, 0x6e, 0x6e) }, + { "Grey44", RGB(0x70, 0x70, 0x70) }, + { "Grey45", RGB(0x73, 0x73, 0x73) }, + { "Grey46", RGB(0x75, 0x75, 0x75) }, + { "Grey47", RGB(0x78, 0x78, 0x78) }, + { "Grey48", RGB(0x7a, 0x7a, 0x7a) }, + { "Grey49", RGB(0x7d, 0x7d, 0x7d) }, + { "Grey5", RGB(0xd, 0xd, 0xd) }, + { "Grey50", RGB(0x7f, 0x7f, 0x7f) }, + { "Grey51", RGB(0x82, 0x82, 0x82) }, + { "Grey52", RGB(0x85, 0x85, 0x85) }, + { "Grey53", RGB(0x87, 0x87, 0x87) }, + { "Grey54", RGB(0x8a, 0x8a, 0x8a) }, + { "Grey55", RGB(0x8c, 0x8c, 0x8c) }, + { "Grey56", RGB(0x8f, 0x8f, 0x8f) }, + { "Grey57", RGB(0x91, 0x91, 0x91) }, + { "Grey58", RGB(0x94, 0x94, 0x94) }, + { "Grey59", RGB(0x96, 0x96, 0x96) }, + { "Grey6", RGB(0xf, 0xf, 0xf) }, + { "Grey60", RGB(0x99, 0x99, 0x99) }, + { "Grey61", RGB(0x9c, 0x9c, 0x9c) }, + { "Grey62", RGB(0x9e, 0x9e, 0x9e) }, + { "Grey63", RGB(0xa1, 0xa1, 0xa1) }, + { "Grey64", RGB(0xa3, 0xa3, 0xa3) }, + { "Grey65", RGB(0xa6, 0xa6, 0xa6) }, + { "Grey66", RGB(0xa8, 0xa8, 0xa8) }, + { "Grey67", RGB(0xab, 0xab, 0xab) }, + { "Grey68", RGB(0xad, 0xad, 0xad) }, + { "Grey69", RGB(0xb0, 0xb0, 0xb0) }, + { "Grey7", RGB(0x12, 0x12, 0x12) }, + { "Grey70", RGB(0xb3, 0xb3, 0xb3) }, + { "Grey71", RGB(0xb5, 0xb5, 0xb5) }, + { "Grey72", RGB(0xb8, 0xb8, 0xb8) }, + { "Grey73", RGB(0xba, 0xba, 0xba) }, + { "Grey74", RGB(0xbd, 0xbd, 0xbd) }, + { "Grey75", RGB(0xbf, 0xbf, 0xbf) }, + { "Grey76", RGB(0xc2, 0xc2, 0xc2) }, + { "Grey77", RGB(0xc4, 0xc4, 0xc4) }, + { "Grey78", RGB(0xc7, 0xc7, 0xc7) }, + { "Grey79", RGB(0xc9, 0xc9, 0xc9) }, + { "Grey8", RGB(0x14, 0x14, 0x14) }, + { "Grey80", RGB(0xcc, 0xcc, 0xcc) }, + { "Grey81", RGB(0xcf, 0xcf, 0xcf) }, + { "Grey82", RGB(0xd1, 0xd1, 0xd1) }, + { "Grey83", RGB(0xd4, 0xd4, 0xd4) }, + { "Grey84", RGB(0xd6, 0xd6, 0xd6) }, + { "Grey85", RGB(0xd9, 0xd9, 0xd9) }, + { "Grey86", RGB(0xdb, 0xdb, 0xdb) }, + { "Grey87", RGB(0xde, 0xde, 0xde) }, + { "Grey88", RGB(0xe0, 0xe0, 0xe0) }, + { "Grey89", RGB(0xe3, 0xe3, 0xe3) }, + { "Grey9", RGB(0x17, 0x17, 0x17) }, + { "Grey90", RGB(0xe5, 0xe5, 0xe5) }, + { "Grey91", RGB(0xe8, 0xe8, 0xe8) }, + { "Grey92", RGB(0xeb, 0xeb, 0xeb) }, + { "Grey93", RGB(0xed, 0xed, 0xed) }, + { "Grey94", RGB(0xf0, 0xf0, 0xf0) }, + { "Grey95", RGB(0xf2, 0xf2, 0xf2) }, + { "Grey96", RGB(0xf5, 0xf5, 0xf5) }, + { "Grey97", RGB(0xf7, 0xf7, 0xf7) }, + { "Grey98", RGB(0xfa, 0xfa, 0xfa) }, + { "Grey99", RGB(0xfc, 0xfc, 0xfc) }, + { "Honeydew", RGB(0xf0, 0xff, 0xf0) }, + { "Honeydew1", RGB(0xf0, 0xff, 0xf0) }, + { "Honeydew2", RGB(0xe0, 0xee, 0xe0) }, + { "Honeydew3", RGB(0xc1, 0xcd, 0xc1) }, + { "Honeydew4", RGB(0x83, 0x8b, 0x83) }, + { "HotPink", RGB(0xff, 0x69, 0xb4) }, + { "HotPink1", RGB(0xff, 0x6e, 0xb4) }, + { "HotPink2", RGB(0xee, 0x6a, 0xa7) }, + { "HotPink3", RGB(0xcd, 0x60, 0x90) }, + { "HotPink4", RGB(0x8b, 0x3a, 0x62) }, + { "IndianRed", RGB(0xcd, 0x5c, 0x5c) }, + { "IndianRed1", RGB(0xff, 0x6a, 0x6a) }, + { "IndianRed2", RGB(0xee, 0x63, 0x63) }, + { "IndianRed3", RGB(0xcd, 0x55, 0x55) }, + { "IndianRed4", RGB(0x8b, 0x3a, 0x3a) }, + { "Indigo", RGB(0x4b, 0x00, 0x82) }, + { "Ivory", RGB(0xff, 0xff, 0xf0) }, + { "Ivory1", RGB(0xff, 0xff, 0xf0) }, + { "Ivory2", RGB(0xee, 0xee, 0xe0) }, + { "Ivory3", RGB(0xcd, 0xcd, 0xc1) }, + { "Ivory4", RGB(0x8b, 0x8b, 0x83) }, + { "Khaki", RGB(0xf0, 0xe6, 0x8c) }, + { "Khaki1", RGB(0xff, 0xf6, 0x8f) }, + { "Khaki2", RGB(0xee, 0xe6, 0x85) }, + { "Khaki3", RGB(0xcd, 0xc6, 0x73) }, + { "Khaki4", RGB(0x8b, 0x86, 0x4e) }, + { "Lavender", RGB(0xe6, 0xe6, 0xfa) }, + { "LavenderBlush", RGB(0xff, 0xf0, 0xf5) }, + { "LavenderBlush1", RGB(0xff, 0xf0, 0xf5) }, + { "LavenderBlush2", RGB(0xee, 0xe0, 0xe5) }, + { "LavenderBlush3", RGB(0xcd, 0xc1, 0xc5) }, + { "LavenderBlush4", RGB(0x8b, 0x83, 0x86) }, + { "LawnGreen", RGB(0x7c, 0xfc, 0x00) }, + { "LemonChiffon", RGB(0xff, 0xfa, 0xcd) }, + { "LemonChiffon1", RGB(0xff, 0xfa, 0xcd) }, + { "LemonChiffon2", RGB(0xee, 0xe9, 0xbf) }, + { "LemonChiffon3", RGB(0xcd, 0xc9, 0xa5) }, + { "LemonChiffon4", RGB(0x8b, 0x89, 0x70) }, + { "LightBlue", RGB(0xad, 0xd8, 0xe6) }, + { "LightBlue1", RGB(0xbf, 0xef, 0xff) }, + { "LightBlue2", RGB(0xb2, 0xdf, 0xee) }, + { "LightBlue3", RGB(0x9a, 0xc0, 0xcd) }, + { "LightBlue4", RGB(0x68, 0x83, 0x8b) }, + { "LightCoral", RGB(0xf0, 0x80, 0x80) }, + { "LightCyan", RGB(0xe0, 0xff, 0xff) }, + { "LightCyan1", RGB(0xe0, 0xff, 0xff) }, + { "LightCyan2", RGB(0xd1, 0xee, 0xee) }, + { "LightCyan3", RGB(0xb4, 0xcd, 0xcd) }, + { "LightCyan4", RGB(0x7a, 0x8b, 0x8b) }, + { "LightGoldenrod", RGB(0xee, 0xdd, 0x82) }, + { "LightGoldenrod1", RGB(0xff, 0xec, 0x8b) }, + { "LightGoldenrod2", RGB(0xee, 0xdc, 0x82) }, + { "LightGoldenrod3", RGB(0xcd, 0xbe, 0x70) }, + { "LightGoldenrod4", RGB(0x8b, 0x81, 0x4c) }, + { "LightGoldenRodYellow", RGB(0xfa, 0xfa, 0xd2) }, + { "LightGray", RGB(0xd3, 0xd3, 0xd3) }, + { "LightGreen", RGB(0x90, 0xee, 0x90) }, + { "LightGrey", RGB(0xd3, 0xd3, 0xd3) }, + { "LightMagenta", RGB(0xff, 0xbb, 0xff) }, + { "LightPink", RGB(0xff, 0xb6, 0xc1) }, + { "LightPink1", RGB(0xff, 0xae, 0xb9) }, + { "LightPink2", RGB(0xee, 0xa2, 0xad) }, + { "LightPink3", RGB(0xcd, 0x8c, 0x95) }, + { "LightPink4", RGB(0x8b, 0x5f, 0x65) }, + { "LightRed", RGB(0xff, 0xbb, 0xbb) }, + { "LightSalmon", RGB(0xff, 0xa0, 0x7a) }, + { "LightSalmon1", RGB(0xff, 0xa0, 0x7a) }, + { "LightSalmon2", RGB(0xee, 0x95, 0x72) }, + { "LightSalmon3", RGB(0xcd, 0x81, 0x62) }, + { "LightSalmon4", RGB(0x8b, 0x57, 0x42) }, + { "LightSeaGreen", RGB(0x20, 0xb2, 0xaa) }, + { "LightSkyBlue", RGB(0x87, 0xce, 0xfa) }, + { "LightSkyBlue1", RGB(0xb0, 0xe2, 0xff) }, + { "LightSkyBlue2", RGB(0xa4, 0xd3, 0xee) }, + { "LightSkyBlue3", RGB(0x8d, 0xb6, 0xcd) }, + { "LightSkyBlue4", RGB(0x60, 0x7b, 0x8b) }, + { "LightSlateBlue", RGB(0x84, 0x70, 0xff) }, + { "LightSlateGray", RGB(0x77, 0x88, 0x99) }, + { "LightSlateGrey", RGB(0x77, 0x88, 0x99) }, + { "LightSteelBlue", RGB(0xb0, 0xc4, 0xde) }, + { "LightSteelBlue1", RGB(0xca, 0xe1, 0xff) }, + { "LightSteelBlue2", RGB(0xbc, 0xd2, 0xee) }, + { "LightSteelBlue3", RGB(0xa2, 0xb5, 0xcd) }, + { "LightSteelBlue4", RGB(0x6e, 0x7b, 0x8b) }, + { "LightYellow", RGB(0xff, 0xff, 0xe0) }, + { "LightYellow1", RGB(0xff, 0xff, 0xe0) }, + { "LightYellow2", RGB(0xee, 0xee, 0xd1) }, + { "LightYellow3", RGB(0xcd, 0xcd, 0xb4) }, + { "LightYellow4", RGB(0x8b, 0x8b, 0x7a) }, + { "Lime", RGB(0x00, 0xff, 0x00) }, + { "LimeGreen", RGB(0x32, 0xcd, 0x32) }, + { "Linen", RGB(0xfa, 0xf0, 0xe6) }, + { "Magenta", RGB(0xff, 0x00, 0xff) }, + { "Magenta1", RGB(0xff, 0x0, 0xff) }, + { "Magenta2", RGB(0xee, 0x0, 0xee) }, + { "Magenta3", RGB(0xcd, 0x0, 0xcd) }, + { "Magenta4", RGB(0x8b, 0x0, 0x8b) }, + { "Maroon", RGB(0x80, 0x00, 0x00) }, + { "Maroon1", RGB(0xff, 0x34, 0xb3) }, + { "Maroon2", RGB(0xee, 0x30, 0xa7) }, + { "Maroon3", RGB(0xcd, 0x29, 0x90) }, + { "Maroon4", RGB(0x8b, 0x1c, 0x62) }, + { "MediumAquamarine", RGB(0x66, 0xcd, 0xaa) }, + { "MediumBlue", RGB(0x00, 0x00, 0xcd) }, + { "MediumOrchid", RGB(0xba, 0x55, 0xd3) }, + { "MediumOrchid1", RGB(0xe0, 0x66, 0xff) }, + { "MediumOrchid2", RGB(0xd1, 0x5f, 0xee) }, + { "MediumOrchid3", RGB(0xb4, 0x52, 0xcd) }, + { "MediumOrchid4", RGB(0x7a, 0x37, 0x8b) }, + { "MediumPurple", RGB(0x93, 0x70, 0xdb) }, + { "MediumPurple1", RGB(0xab, 0x82, 0xff) }, + { "MediumPurple2", RGB(0x9f, 0x79, 0xee) }, + { "MediumPurple3", RGB(0x89, 0x68, 0xcd) }, + { "MediumPurple4", RGB(0x5d, 0x47, 0x8b) }, + { "MediumSeaGreen", RGB(0x3c, 0xb3, 0x71) }, + { "MediumSlateBlue", RGB(0x7b, 0x68, 0xee) }, + { "MediumSpringGreen", RGB(0x00, 0xfa, 0x9a) }, + { "MediumTurquoise", RGB(0x48, 0xd1, 0xcc) }, + { "MediumVioletRed", RGB(0xc7, 0x15, 0x85) }, + { "MidnightBlue", RGB(0x19, 0x19, 0x70) }, + { "MintCream", RGB(0xf5, 0xff, 0xfa) }, + { "MistyRose", RGB(0xff, 0xe4, 0xe1) }, + { "MistyRose1", RGB(0xff, 0xe4, 0xe1) }, + { "MistyRose2", RGB(0xee, 0xd5, 0xd2) }, + { "MistyRose3", RGB(0xcd, 0xb7, 0xb5) }, + { "MistyRose4", RGB(0x8b, 0x7d, 0x7b) }, + { "Moccasin", RGB(0xff, 0xe4, 0xb5) }, + { "NavajoWhite", RGB(0xff, 0xde, 0xad) }, + { "NavajoWhite1", RGB(0xff, 0xde, 0xad) }, + { "NavajoWhite2", RGB(0xee, 0xcf, 0xa1) }, + { "NavajoWhite3", RGB(0xcd, 0xb3, 0x8b) }, + { "NavajoWhite4", RGB(0x8b, 0x79, 0x5e) }, + { "Navy", RGB(0x00, 0x00, 0x80) }, + { "NavyBlue", RGB(0x0, 0x0, 0x80) }, + { "OldLace", RGB(0xfd, 0xf5, 0xe6) }, + { "Olive", RGB(0x80, 0x80, 0x00) }, + { "OliveDrab", RGB(0x6b, 0x8e, 0x23) }, + { "OliveDrab1", RGB(0xc0, 0xff, 0x3e) }, + { "OliveDrab2", RGB(0xb3, 0xee, 0x3a) }, + { "OliveDrab3", RGB(0x9a, 0xcd, 0x32) }, + { "OliveDrab4", RGB(0x69, 0x8b, 0x22) }, + { "Orange", RGB(0xff, 0xa5, 0x00) }, + { "Orange1", RGB(0xff, 0xa5, 0x0) }, + { "Orange2", RGB(0xee, 0x9a, 0x0) }, + { "Orange3", RGB(0xcd, 0x85, 0x0) }, + { "Orange4", RGB(0x8b, 0x5a, 0x0) }, + { "OrangeRed", RGB(0xff, 0x45, 0x00) }, + { "OrangeRed1", RGB(0xff, 0x45, 0x0) }, + { "OrangeRed2", RGB(0xee, 0x40, 0x0) }, + { "OrangeRed3", RGB(0xcd, 0x37, 0x0) }, + { "OrangeRed4", RGB(0x8b, 0x25, 0x0) }, + { "Orchid", RGB(0xda, 0x70, 0xd6) }, + { "Orchid1", RGB(0xff, 0x83, 0xfa) }, + { "Orchid2", RGB(0xee, 0x7a, 0xe9) }, + { "Orchid3", RGB(0xcd, 0x69, 0xc9) }, + { "Orchid4", RGB(0x8b, 0x47, 0x89) }, + { "PaleGoldenRod", RGB(0xee, 0xe8, 0xaa) }, + { "PaleGreen", RGB(0x98, 0xfb, 0x98) }, + { "PaleGreen1", RGB(0x9a, 0xff, 0x9a) }, + { "PaleGreen2", RGB(0x90, 0xee, 0x90) }, + { "PaleGreen3", RGB(0x7c, 0xcd, 0x7c) }, + { "PaleGreen4", RGB(0x54, 0x8b, 0x54) }, + { "PaleTurquoise", RGB(0xaf, 0xee, 0xee) }, + { "PaleTurquoise1", RGB(0xbb, 0xff, 0xff) }, + { "PaleTurquoise2", RGB(0xae, 0xee, 0xee) }, + { "PaleTurquoise3", RGB(0x96, 0xcd, 0xcd) }, + { "PaleTurquoise4", RGB(0x66, 0x8b, 0x8b) }, + { "PaleVioletRed", RGB(0xdb, 0x70, 0x93) }, + { "PaleVioletRed1", RGB(0xff, 0x82, 0xab) }, + { "PaleVioletRed2", RGB(0xee, 0x79, 0x9f) }, + { "PaleVioletRed3", RGB(0xcd, 0x68, 0x89) }, + { "PaleVioletRed4", RGB(0x8b, 0x47, 0x5d) }, + { "PapayaWhip", RGB(0xff, 0xef, 0xd5) }, + { "PeachPuff", RGB(0xff, 0xda, 0xb9) }, + { "PeachPuff1", RGB(0xff, 0xda, 0xb9) }, + { "PeachPuff2", RGB(0xee, 0xcb, 0xad) }, + { "PeachPuff3", RGB(0xcd, 0xaf, 0x95) }, + { "PeachPuff4", RGB(0x8b, 0x77, 0x65) }, + { "Peru", RGB(0xcd, 0x85, 0x3f) }, + { "Pink", RGB(0xff, 0xc0, 0xcb) }, + { "Pink1", RGB(0xff, 0xb5, 0xc5) }, + { "Pink2", RGB(0xee, 0xa9, 0xb8) }, + { "Pink3", RGB(0xcd, 0x91, 0x9e) }, + { "Pink4", RGB(0x8b, 0x63, 0x6c) }, + { "Plum", RGB(0xdd, 0xa0, 0xdd) }, + { "Plum1", RGB(0xff, 0xbb, 0xff) }, + { "Plum2", RGB(0xee, 0xae, 0xee) }, + { "Plum3", RGB(0xcd, 0x96, 0xcd) }, + { "Plum4", RGB(0x8b, 0x66, 0x8b) }, + { "PowderBlue", RGB(0xb0, 0xe0, 0xe6) }, + { "Purple", RGB(0x80, 0x00, 0x80) }, + { "Purple1", RGB(0x9b, 0x30, 0xff) }, + { "Purple2", RGB(0x91, 0x2c, 0xee) }, + { "Purple3", RGB(0x7d, 0x26, 0xcd) }, + { "Purple4", RGB(0x55, 0x1a, 0x8b) }, + { "RebeccaPurple", RGB(0x66, 0x33, 0x99) }, + { "Red", RGB(0xff, 0x00, 0x00) }, + { "Red1", RGB(0xff, 0x0, 0x0) }, + { "Red2", RGB(0xee, 0x0, 0x0) }, + { "Red3", RGB(0xcd, 0x0, 0x0) }, + { "Red4", RGB(0x8b, 0x0, 0x0) }, + { "RosyBrown", RGB(0xbc, 0x8f, 0x8f) }, + { "RosyBrown1", RGB(0xff, 0xc1, 0xc1) }, + { "RosyBrown2", RGB(0xee, 0xb4, 0xb4) }, + { "RosyBrown3", RGB(0xcd, 0x9b, 0x9b) }, + { "RosyBrown4", RGB(0x8b, 0x69, 0x69) }, + { "RoyalBlue", RGB(0x41, 0x69, 0xe1) }, + { "RoyalBlue1", RGB(0x48, 0x76, 0xff) }, + { "RoyalBlue2", RGB(0x43, 0x6e, 0xee) }, + { "RoyalBlue3", RGB(0x3a, 0x5f, 0xcd) }, + { "RoyalBlue4", RGB(0x27, 0x40, 0x8b) }, + { "SaddleBrown", RGB(0x8b, 0x45, 0x13) }, + { "Salmon", RGB(0xfa, 0x80, 0x72) }, + { "Salmon1", RGB(0xff, 0x8c, 0x69) }, + { "Salmon2", RGB(0xee, 0x82, 0x62) }, + { "Salmon3", RGB(0xcd, 0x70, 0x54) }, + { "Salmon4", RGB(0x8b, 0x4c, 0x39) }, + { "SandyBrown", RGB(0xf4, 0xa4, 0x60) }, + { "SeaGreen", RGB(0x2e, 0x8b, 0x57) }, + { "SeaGreen1", RGB(0x54, 0xff, 0x9f) }, + { "SeaGreen2", RGB(0x4e, 0xee, 0x94) }, + { "SeaGreen3", RGB(0x43, 0xcd, 0x80) }, + { "SeaGreen4", RGB(0x2e, 0x8b, 0x57) }, + { "SeaShell", RGB(0xff, 0xf5, 0xee) }, + { "Seashell1", RGB(0xff, 0xf5, 0xee) }, + { "Seashell2", RGB(0xee, 0xe5, 0xde) }, + { "Seashell3", RGB(0xcd, 0xc5, 0xbf) }, + { "Seashell4", RGB(0x8b, 0x86, 0x82) }, + { "Sienna", RGB(0xa0, 0x52, 0x2d) }, + { "Sienna1", RGB(0xff, 0x82, 0x47) }, + { "Sienna2", RGB(0xee, 0x79, 0x42) }, + { "Sienna3", RGB(0xcd, 0x68, 0x39) }, + { "Sienna4", RGB(0x8b, 0x47, 0x26) }, + { "Silver", RGB(0xc0, 0xc0, 0xc0) }, + { "SkyBlue", RGB(0x87, 0xce, 0xeb) }, + { "SkyBlue1", RGB(0x87, 0xce, 0xff) }, + { "SkyBlue2", RGB(0x7e, 0xc0, 0xee) }, + { "SkyBlue3", RGB(0x6c, 0xa6, 0xcd) }, + { "SkyBlue4", RGB(0x4a, 0x70, 0x8b) }, + { "SlateBlue", RGB(0x6a, 0x5a, 0xcd) }, + { "SlateBlue1", RGB(0x83, 0x6f, 0xff) }, + { "SlateBlue2", RGB(0x7a, 0x67, 0xee) }, + { "SlateBlue3", RGB(0x69, 0x59, 0xcd) }, + { "SlateBlue4", RGB(0x47, 0x3c, 0x8b) }, + { "SlateGray", RGB(0x70, 0x80, 0x90) }, + { "SlateGray1", RGB(0xc6, 0xe2, 0xff) }, + { "SlateGray2", RGB(0xb9, 0xd3, 0xee) }, + { "SlateGray3", RGB(0x9f, 0xb6, 0xcd) }, + { "SlateGray4", RGB(0x6c, 0x7b, 0x8b) }, + { "SlateGrey", RGB(0x70, 0x80, 0x90) }, + { "Snow", RGB(0xff, 0xfa, 0xfa) }, + { "Snow1", RGB(0xff, 0xfa, 0xfa) }, + { "Snow2", RGB(0xee, 0xe9, 0xe9) }, + { "Snow3", RGB(0xcd, 0xc9, 0xc9) }, + { "Snow4", RGB(0x8b, 0x89, 0x89) }, + { "SpringGreen", RGB(0x00, 0xff, 0x7f) }, + { "SpringGreen1", RGB(0x0, 0xff, 0x7f) }, + { "SpringGreen2", RGB(0x0, 0xee, 0x76) }, + { "SpringGreen3", RGB(0x0, 0xcd, 0x66) }, + { "SpringGreen4", RGB(0x0, 0x8b, 0x45) }, + { "SteelBlue", RGB(0x46, 0x82, 0xb4) }, + { "SteelBlue1", RGB(0x63, 0xb8, 0xff) }, + { "SteelBlue2", RGB(0x5c, 0xac, 0xee) }, + { "SteelBlue3", RGB(0x4f, 0x94, 0xcd) }, + { "SteelBlue4", RGB(0x36, 0x64, 0x8b) }, + { "Tan", RGB(0xd2, 0xb4, 0x8c) }, + { "Tan1", RGB(0xff, 0xa5, 0x4f) }, + { "Tan2", RGB(0xee, 0x9a, 0x49) }, + { "Tan3", RGB(0xcd, 0x85, 0x3f) }, + { "Tan4", RGB(0x8b, 0x5a, 0x2b) }, + { "Teal", RGB(0x00, 0x80, 0x80) }, + { "Thistle", RGB(0xd8, 0xbf, 0xd8) }, + { "Thistle1", RGB(0xff, 0xe1, 0xff) }, + { "Thistle2", RGB(0xee, 0xd2, 0xee) }, + { "Thistle3", RGB(0xcd, 0xb5, 0xcd) }, + { "Thistle4", RGB(0x8b, 0x7b, 0x8b) }, + { "Tomato", RGB(0xff, 0x63, 0x47) }, + { "Tomato1", RGB(0xff, 0x63, 0x47) }, + { "Tomato2", RGB(0xee, 0x5c, 0x42) }, + { "Tomato3", RGB(0xcd, 0x4f, 0x39) }, + { "Tomato4", RGB(0x8b, 0x36, 0x26) }, + { "Turquoise", RGB(0x40, 0xe0, 0xd0) }, + { "Turquoise1", RGB(0x0, 0xf5, 0xff) }, + { "Turquoise2", RGB(0x0, 0xe5, 0xee) }, + { "Turquoise3", RGB(0x0, 0xc5, 0xcd) }, + { "Turquoise4", RGB(0x0, 0x86, 0x8b) }, + { "Violet", RGB(0xee, 0x82, 0xee) }, + { "VioletRed", RGB(0xd0, 0x20, 0x90) }, + { "VioletRed1", RGB(0xff, 0x3e, 0x96) }, + { "VioletRed2", RGB(0xee, 0x3a, 0x8c) }, + { "VioletRed3", RGB(0xcd, 0x32, 0x78) }, + { "VioletRed4", RGB(0x8b, 0x22, 0x52) }, + { "WebGray", RGB(0x80, 0x80, 0x80) }, + { "WebGreen", RGB(0x0, 0x80, 0x0) }, + { "WebGrey", RGB(0x80, 0x80, 0x80) }, + { "WebMaroon", RGB(0x80, 0x0, 0x0) }, + { "WebPurple", RGB(0x80, 0x0, 0x80) }, + { "Wheat", RGB(0xf5, 0xde, 0xb3) }, + { "Wheat1", RGB(0xff, 0xe7, 0xba) }, + { "Wheat2", RGB(0xee, 0xd8, 0xae) }, + { "Wheat3", RGB(0xcd, 0xba, 0x96) }, + { "Wheat4", RGB(0x8b, 0x7e, 0x66) }, + { "White", RGB(0xff, 0xff, 0xff) }, + { "WhiteSmoke", RGB(0xf5, 0xf5, 0xf5) }, + { "X11Gray", RGB(0xbe, 0xbe, 0xbe) }, + { "X11Green", RGB(0x0, 0xff, 0x0) }, + { "X11Grey", RGB(0xbe, 0xbe, 0xbe) }, + { "X11Maroon", RGB(0xb0, 0x30, 0x60) }, + { "X11Purple", RGB(0xa0, 0x20, 0xf0) }, + { "Yellow", RGB(0xff, 0xff, 0x00) }, + { "Yellow1", RGB(0xff, 0xff, 0x0) }, + { "Yellow2", RGB(0xee, 0xee, 0x0) }, + { "Yellow3", RGB(0xcd, 0xcd, 0x0) }, + { "Yellow4", RGB(0x8b, 0x8b, 0x0) }, + { "YellowGreen", RGB(0x9a, 0xcd, 0x32) }, + { NULL, 0 }, }; RgbValue name_to_color(uint8_t *name) diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 46fad688cc..1df1952f53 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -214,8 +214,12 @@ do_tag ( * Don't add a tag to the tagstack if 'tagstack' has been reset. */ if (!p_tgst && *tag != NUL) { - use_tagstack = FALSE; - new_tag = TRUE; + use_tagstack = false; + new_tag = true; + if (g_do_tagpreview != 0) { + xfree(ptag_entry.tagname); + ptag_entry.tagname = vim_strsave(tag); + } } else { if (g_do_tagpreview != 0) use_tagstack = FALSE; diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index c6e9c26c57..dba8a8a877 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -37,13 +37,14 @@ NEW_TESTS = \ test_help_tagjump.res \ test_history.res \ test_langmap.res \ + test_match.res \ + test_matchadd_conceal.res \ test_syntax.res \ test_usercommands.res \ test_timers.res \ test_viml.res \ test_visual.res \ test_window_id.res \ - test_matchadd_conceal.res \ test_alot.res SCRIPTS_GUI := test16.out @@ -116,6 +117,7 @@ clean: valgrind.* \ .*.swp \ .*.swo \ + .gdbinit \ del test1.out: .gdbinit test1.in diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index 9681982d14..c79d9380d4 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -8,6 +8,9 @@ source test_ex_undo.vim source test_expr.vim source test_expr_utf8.vim source test_feedkeys.vim +source test_goto.vim +source test_match.vim +source test_matchadd_conceal_utf8.vim source test_menu.vim source test_messages.vim source test_options.vim @@ -17,6 +20,6 @@ source test_statusline.vim source test_syn_attr.vim source test_tabline.vim source test_tabpage.vim +source test_tagjump.vim source test_unlet.vim source test_window_cmd.vim -source test_matchadd_conceal_utf8.vim diff --git a/src/nvim/testdir/test_goto.vim b/src/nvim/testdir/test_goto.vim new file mode 100644 index 0000000000..fb8f190fa6 --- /dev/null +++ b/src/nvim/testdir/test_goto.vim @@ -0,0 +1,10 @@ +" Test commands that jump somewhere. + +func Test_geedee() + new + call setline(1, ["Filename x;", "", "int Filename", "int func() {", "Filename y;"]) + /y;/ + normal gD + call assert_equal(1, line('.')) + quit! +endfunc diff --git a/src/nvim/testdir/test_match.vim b/src/nvim/testdir/test_match.vim new file mode 100644 index 0000000000..7748dee87f --- /dev/null +++ b/src/nvim/testdir/test_match.vim @@ -0,0 +1,234 @@ +" Test for :match, :2match, :3match, clearmatches(), getmatches(), matchadd(), +" matchaddpos(), matcharg(), matchdelete(), matchstrpos() and setmatches(). + +function Test_match() + highlight MyGroup1 term=bold ctermbg=red guibg=red + highlight MyGroup2 term=italic ctermbg=green guibg=green + highlight MyGroup3 term=underline ctermbg=blue guibg=blue + + " --- Check that "matcharg()" returns the correct group and pattern if a match + " --- is defined. + match MyGroup1 /TODO/ + 2match MyGroup2 /FIXME/ + 3match MyGroup3 /XXX/ + call assert_equal(['MyGroup1', 'TODO'], matcharg(1)) + call assert_equal(['MyGroup2', 'FIXME'], matcharg(2)) + call assert_equal(['MyGroup3', 'XXX'], matcharg(3)) + + " --- Check that "matcharg()" returns an empty list if the argument is not 1, + " --- 2 or 3 (only 0 and 4 are tested). + call assert_equal([], matcharg(0)) + call assert_equal([], matcharg(4)) + + " --- Check that "matcharg()" returns ['', ''] if a match is not defined. + match + 2match + 3match + call assert_equal(['', ''], matcharg(1)) + call assert_equal(['', ''], matcharg(2)) + call assert_equal(['', ''], matcharg(3)) + + " --- Check that "matchadd()" and "getmatches()" agree on added matches and + " --- that default values apply. + let m1 = matchadd("MyGroup1", "TODO") + let m2 = matchadd("MyGroup2", "FIXME", 42) + let m3 = matchadd("MyGroup3", "XXX", 60, 17) + let ans = [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 4}, + \ {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 42, 'id': 5}, + \ {'group': 'MyGroup3', 'pattern': 'XXX', 'priority': 60, 'id': 17}] + call assert_equal(ans, getmatches()) + + " --- Check that "matchdelete()" deletes the matches defined in the previous + " --- test correctly. + call matchdelete(m1) + call matchdelete(m2) + call matchdelete(m3) + call assert_equal([], getmatches()) + + " --- Check that "matchdelete()" returns 0 if successful and otherwise -1. + let m = matchadd("MyGroup1", "TODO") + call assert_equal(0, matchdelete(m)) + call assert_fails('call matchdelete(42)', 'E803:') + + " --- Check that "clearmatches()" clears all matches defined by ":match" and + " --- "matchadd()". + let m1 = matchadd("MyGroup1", "TODO") + let m2 = matchadd("MyGroup2", "FIXME", 42) + let m3 = matchadd("MyGroup3", "XXX", 60, 17) + match MyGroup1 /COFFEE/ + 2match MyGroup2 /HUMPPA/ + 3match MyGroup3 /VIM/ + call clearmatches() + call assert_equal([], getmatches()) + + " --- Check that "setmatches()" restores a list of matches saved by + " --- "getmatches()" without changes. (Matches with equal priority must also + " --- remain in the same order.) + let m1 = matchadd("MyGroup1", "TODO") + let m2 = matchadd("MyGroup2", "FIXME", 42) + let m3 = matchadd("MyGroup3", "XXX", 60, 17) + match MyGroup1 /COFFEE/ + 2match MyGroup2 /HUMPPA/ + 3match MyGroup3 /VIM/ + let ml = getmatches() + call clearmatches() + call setmatches(ml) + call assert_equal(ml, getmatches()) + call clearmatches() + + " --- Check that "setmatches()" will not add two matches with the same ID. The + " --- expected behaviour (for now) is to add the first match but not the + " --- second and to return 0 (even though it is a matter of debate whether + " --- this can be considered successful behaviour). + let data = [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, + \ {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}] + call assert_fails('call setmatches(data)', 'E801:') + call assert_equal([data[0]], getmatches()) + call clearmatches() + + " --- Check that "setmatches()" returns 0 if successful and otherwise -1. + " --- (A range of valid and invalid input values are tried out to generate the + " --- return values.) + call assert_equal(0, setmatches([])) + call assert_equal(0, setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}])) + call clearmatches() + call assert_fails('call setmatches(0)', 'E714:') + call assert_fails('call setmatches([0])', 'E474:') + call assert_fails("call setmatches([{'wrong key': 'wrong value'}])", 'E474:') + + call setline(1, 'abcdefghijklmnopq') + call matchaddpos("MyGroup1", [[1, 5], [1, 8, 3]], 10, 3) + 1 + redraw! + let v1 = screenattr(1, 1) + let v5 = screenattr(1, 5) + let v6 = screenattr(1, 6) + let v8 = screenattr(1, 8) + let v10 = screenattr(1, 10) + let v11 = screenattr(1, 11) + call assert_notequal(v1, v5) + call assert_equal(v6, v1) + call assert_equal(v8, v5) + call assert_equal(v10, v5) + call assert_equal(v11, v1) + call assert_equal([{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}], getmatches()) + call clearmatches() + + " + if has('multi_byte') + call setline(1, 'abcdΣabcdef') + call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]]) + 1 + redraw! + let v1 = screenattr(1, 1) + let v4 = screenattr(1, 4) + let v5 = screenattr(1, 5) + let v6 = screenattr(1, 6) + let v7 = screenattr(1, 7) + let v8 = screenattr(1, 8) + let v9 = screenattr(1, 9) + let v10 = screenattr(1, 10) + call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}], getmatches()) + call assert_notequal(v1, v4) + call assert_equal(v5, v4) + call assert_equal(v6, v1) + call assert_equal(v7, v1) + call assert_equal(v8, v4) + call assert_equal(v9, v4) + call assert_equal(v10, v1) + + " Check, that setmatches() can correctly restore the matches from matchaddpos() + call matchadd('MyGroup1', '\%2lmatchadd') + let m=getmatches() + call clearmatches() + call setmatches(m) + call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1,9, 2]}, {'group': 'MyGroup1', 'pattern': '\%2lmatchadd', 'priority': 10, 'id': 12}], getmatches()) + endif + + highlight MyGroup1 NONE + highlight MyGroup2 NONE + highlight MyGroup3 NONE +endfunc + +func Test_matchstrpos() + call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing')) + + call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2)) + + call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5)) + + call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) + + call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) +endfunc + +func Test_matchaddpos() + syntax on + set hlsearch + + call setline(1, ['12345', 'NP']) + call matchaddpos('Error', [[1,2], [1,6], [2,2]]) + redraw! + call assert_notequal(screenattr(2,2), 0) + call assert_equal(screenattr(2,2), screenattr(1,2)) + call assert_notequal(screenattr(2,2), screenattr(1,6)) + 1 + call matchadd('Search', 'N\|\n') + redraw! + call assert_notequal(screenattr(2,1), 0) + call assert_equal(screenattr(2,1), screenattr(1,6)) + exec "norm! i0\<Esc>" + redraw! + call assert_equal(screenattr(2,2), screenattr(1,6)) + + " Check overlapping pos + call clearmatches() + call setline(1, ['1234567890', 'NH']) + call matchaddpos('Error', [[1,1,5], [1,3,5], [2,2]]) + redraw! + call assert_notequal(screenattr(2,2), 0) + call assert_equal(screenattr(2,2), screenattr(1,5)) + call assert_equal(screenattr(2,2), screenattr(1,7)) + call assert_notequal(screenattr(2,2), screenattr(1,8)) + + call clearmatches() + call matchaddpos('Error', [[1], [2,2]]) + redraw! + call assert_equal(screenattr(2,2), screenattr(1,1)) + call assert_equal(screenattr(2,2), screenattr(1,10)) + call assert_notequal(screenattr(2,2), screenattr(1,11)) + + nohl + call clearmatches() + syntax off + set hlsearch& +endfunc + +func Test_matchaddpos_using_negative_priority() + set hlsearch + + call clearmatches() + + call setline(1, 'x') + let @/='x' + redraw! + let search_attr = screenattr(1,1) + + let @/='' + call matchaddpos('Error', [1], 10) + redraw! + let error_attr = screenattr(1,1) + + call setline(2, '-1 match priority') + call matchaddpos('Error', [2], -1) + redraw! + let negative_match_priority_attr = screenattr(2,1) + + call assert_notequal(negative_match_priority_attr, search_attr, "Match with negative priority is incorrectly highlighted with Search highlight.") + call assert_equal(negative_match_priority_attr, error_attr) + + nohl + set hlsearch& +endfunc + +" vim: et ts=2 sw=2 diff --git a/src/nvim/testdir/test_tabpage.vim b/src/nvim/testdir/test_tabpage.vim index 0bf7d056de..7c3039ba24 100644 --- a/src/nvim/testdir/test_tabpage.vim +++ b/src/nvim/testdir/test_tabpage.vim @@ -40,7 +40,7 @@ function Test_tabpage() call assert_true(t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green']) tabclose - if has('gui') || has('clientserver') + if has('nvim') || has('gui') || has('clientserver') " Test for ":tab drop exist-file" to keep current window. sp test1 tab drop test1 @@ -64,6 +64,15 @@ function Test_tabpage() call assert_true(tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1) tabclose q + " + " + " Test for ":tab drop vertical-split-window" to jump test1 buffer + tabedit test1 + vnew + tabfirst + tab drop test1 + call assert_equal([2, 2, 2, 2], [tabpagenr('$'), tabpagenr(), tabpagewinnr(2, '$'), tabpagewinnr(2)]) + 1tabonly endif " " diff --git a/src/nvim/testdir/test_tagjump.vim b/src/nvim/testdir/test_tagjump.vim new file mode 100644 index 0000000000..d8a333f44c --- /dev/null +++ b/src/nvim/testdir/test_tagjump.vim @@ -0,0 +1,9 @@ +" Tests for tagjump (tags and special searches) + +" SEGV occurs in older versions. (At least 7.4.1748 or older) +func Test_ptag_with_notagstack() + set notagstack + call assert_fails('ptag does_not_exist_tag_name', 'E426') + set tagstack&vim +endfunc +" vim: sw=2 et diff --git a/src/nvim/version.c b/src/nvim/version.c index 431c92d436..821922fd38 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -225,7 +225,7 @@ static int included_patches[] = { // 2220, 2219, // 2218 NA - // 2217, + 2217, // 2216 NA // 2215, // 2214 NA @@ -279,7 +279,7 @@ static int included_patches[] = { // 2166 NA // 2165, // 2164, - // 2163, + 2163, 2162, // 2161, // 2160, @@ -693,10 +693,10 @@ static int included_patches[] = { 1753, // 1753, // 1752, - // 1751, + 1751, // 1750 NA // 1749 NA - // 1748, + 1748, // 1747 NA // 1746 NA // 1745 NA @@ -736,7 +736,7 @@ static int included_patches[] = { 1711, // 1710 NA // 1709 NA - // 1708, + 1708, 1707, // 1706 NA // 1705 NA @@ -759,7 +759,7 @@ static int included_patches[] = { // 1688 NA // 1687 NA 1686, - // 1685, + 1685, // 1684 NA // 1683 NA 1682, diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 58594db8ac..9d24ba62db 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -481,10 +481,9 @@ describe('jobs', function() eq('rows: 40, cols: 10', next_chunk()) end) - it('calling jobclose()', function() - -- this should send SIGHUP to the process + it('jobclose() sends SIGHUP', function() nvim('command', 'call jobclose(j)') - eq({'notification', 'exit', {0, 1}}, next_msg()) + eq({'notification', 'exit', {0, 42}}, next_msg()) end) end) end) diff --git a/test/functional/fixtures/tty-test.c b/test/functional/fixtures/tty-test.c index ca905ce65e..778e7f3cd3 100644 --- a/test/functional/fixtures/tty-test.c +++ b/test/functional/fixtures/tty-test.c @@ -32,11 +32,21 @@ static void walk_cb(uv_handle_t *handle, void *arg) { } #ifndef WIN32 -static void sigwinch_handler(int signum) +static void sig_handler(int signum) { - int width, height; - uv_tty_get_winsize(&tty, &width, &height); - fprintf(stderr, "rows: %d, cols: %d\n", height, width); + switch(signum) { + case SIGWINCH: { + int width, height; + uv_tty_get_winsize(&tty, &width, &height); + fprintf(stderr, "rows: %d, cols: %d\n", height, width); + return; + } + case SIGHUP: + exit(42); // arbitrary exit code to test against + return; + default: + return; + } } #endif @@ -141,7 +151,8 @@ int main(int argc, char **argv) struct sigaction sa; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - sa.sa_handler = sigwinch_handler; + sa.sa_handler = sig_handler; + sigaction(SIGHUP, &sa, NULL); sigaction(SIGWINCH, &sa, NULL); // uv_signal_t sigwinch_watcher; // uv_signal_init(uv_default_loop(), &sigwinch_watcher); @@ -150,5 +161,8 @@ int main(int argc, char **argv) #endif uv_run(uv_default_loop(), UV_RUN_DEFAULT); + // XXX: Without this the SIGHUP handler is skipped on some systems. + sleep(100); + return 0; } diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index ff62b4de86..d1ab02f361 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -243,6 +243,19 @@ local function connect(file_or_address) return Session.new(stream) end +-- Calls fn() until it returns without error, up to `max` times. +local function retry(fn, max) + local retries = max and (max - 1) or 2 + for _ = 1, retries do + local success = pcall(fn) + if success then + return + end + end + -- pcall() is not used for the final attempt so failure can bubble up. + fn() +end + local function clear(...) local args = {unpack(nvim_argv)} local new_args @@ -530,6 +543,7 @@ return function(after_each) prepend_argv = prepend_argv, clear = clear, connect = connect, + retry = retry, spawn = spawn, dedent = dedent, source = source, diff --git a/test/functional/legacy/061_undo_tree_spec.lua b/test/functional/legacy/061_undo_tree_spec.lua index 9bf69ccba1..2069204938 100644 --- a/test/functional/legacy/061_undo_tree_spec.lua +++ b/test/functional/legacy/061_undo_tree_spec.lua @@ -98,15 +98,7 @@ describe('undo tree:', function() expect_line('123456abc') end - -- Retry up to 3 times. pcall() is _not_ used for the final attempt, so - -- that failure messages can bubble up. - for _ = 1, 2 do - local success = pcall(test_earlier_later) - if success then - return - end - end - test_earlier_later() + helpers.retry(test_earlier_later) end) it('file-write specifications', function() diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 13bfe9e23f..b729b0db08 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -153,8 +153,9 @@ describe('Mouse input', function() end) it('in tabline to the left moves tab left', function() - if os.getenv("TRAVIS") and helpers.os_name() == "osx" then - pending("[Fails on Travis macOS. #4874]", function() end) + if os.getenv("TRAVIS") and (helpers.os_name() == "osx" + or os.getenv("CLANG_SANITIZER") == "ASAN_UBSAN") then + pending("[Fails on Travis macOS, ASAN_UBSAN. #4874]", function() end) return end @@ -256,8 +257,9 @@ describe('Mouse input', function() end) it('out of tabline to the left moves tab left', function() - if os.getenv("TRAVIS") and helpers.os_name() == "osx" then - pending("[Fails on Travis macOS. #4874]", function() end) + if os.getenv("TRAVIS") and (helpers.os_name() == "osx" + or os.getenv("CLANG_SANITIZER") == "ASAN_UBSAN") then + pending("[Fails on Travis macOS, ASAN_UBSAN. #4874]", function() end) return end diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 821961a2bf..f746b88276 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -96,8 +96,8 @@ set(MSGPACK_SHA256 afda64ca445203bb7092372b822bae8b2539fdcebbfc3f753f393628c2bcf set(LUAJIT_URL https://github.com/neovim/deps/raw/master/opt/LuaJIT-2.0.4.tar.gz) set(LUAJIT_SHA256 620fa4eb12375021bef6e4f237cbd2dd5d49e56beb414bee052c746beef1807d) -set(LUA_URL https://github.com/lua/lua/archive/5.1.5.tar.gz) -set(LUA_SHA256 1cd642c4c39778306a14e62ccddace5c7a4fb2257b0b06f43bc81cf305c7415f) +set(LUA_URL https://www.lua.org/ftp/lua-5.1.5.tar.gz) +set(LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333) set(LUAROCKS_URL https://github.com/keplerproject/luarocks/archive/5d8a16526573b36d5b22aa74866120c998466697.tar.gz) set(LUAROCKS_SHA256 cae709111c5701235770047dfd7169f66b82ae1c7b9b79207f9df0afb722bfd9) |