mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
@@ -136,6 +136,7 @@ SRC_ALL = \
|
||||
src/testdir/bench*.vim \
|
||||
src/testdir/samples/*.txt \
|
||||
src/testdir/if_ver*.vim \
|
||||
src/testdir/xterm_ramp.vim \
|
||||
src/proto.h \
|
||||
src/proto/arabic.pro \
|
||||
src/proto/blowfish.pro \
|
||||
|
||||
+1
-1
@@ -8216,7 +8216,7 @@ in_cinkeys(
|
||||
{
|
||||
/* "0=word": Check if there are only blanks before the
|
||||
* word. */
|
||||
if (getwhitecols(line) !=
|
||||
if (getwhitecols_curline() !=
|
||||
(int)(curwin->w_cursor.col - (p - look)))
|
||||
match = FALSE;
|
||||
}
|
||||
|
||||
@@ -10321,6 +10321,9 @@ ex_startinsert(exarg_T *eap)
|
||||
{
|
||||
if (eap->forceit)
|
||||
{
|
||||
/* cursor line can be zero on startup */
|
||||
if (!curwin->w_cursor.lnum)
|
||||
curwin->w_cursor.lnum = 1;
|
||||
coladvance((colnr_T)MAXCOL);
|
||||
curwin->w_curswant = MAXCOL;
|
||||
curwin->w_set_curswant = FALSE;
|
||||
|
||||
+15
-14
@@ -4384,7 +4384,7 @@ add_dialog_element(
|
||||
WORD clss,
|
||||
const char *caption);
|
||||
static LPWORD lpwAlign(LPWORD);
|
||||
static int nCopyAnsiToWideChar(LPWORD, LPSTR);
|
||||
static int nCopyAnsiToWideChar(LPWORD, LPSTR, BOOL);
|
||||
#if defined(FEAT_MENU) && defined(FEAT_TEAROFF)
|
||||
static void gui_mch_tearoff(char_u *title, vimmenu_T *menu, int initX, int initY);
|
||||
#endif
|
||||
@@ -7284,9 +7284,8 @@ gui_mch_dialog(
|
||||
add_word(0); // Class
|
||||
|
||||
/* copy the title of the dialog */
|
||||
nchar = nCopyAnsiToWideChar(p, (title ?
|
||||
(LPSTR)title :
|
||||
(LPSTR)("Vim "VIM_VERSION_MEDIUM)));
|
||||
nchar = nCopyAnsiToWideChar(p, (title ? (LPSTR)title
|
||||
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
|
||||
p += nchar;
|
||||
|
||||
if (s_usenewlook)
|
||||
@@ -7298,13 +7297,13 @@ gui_mch_dialog(
|
||||
/* point size */
|
||||
*p++ = -MulDiv(lfSysmenu.lfHeight, 72,
|
||||
GetDeviceCaps(hdc, LOGPIXELSY));
|
||||
nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName));
|
||||
nchar = nCopyAnsiToWideChar(p, lfSysmenu.lfFaceName, FALSE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*p++ = DLG_FONT_POINT_SIZE; // point size
|
||||
nchar = nCopyAnsiToWideChar(p, TEXT(DLG_FONT_NAME));
|
||||
nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
|
||||
}
|
||||
p += nchar;
|
||||
}
|
||||
@@ -7485,7 +7484,7 @@ add_dialog_element(
|
||||
*p++ = (WORD)0xffff;
|
||||
*p++ = clss; //2 more here
|
||||
|
||||
nchar = nCopyAnsiToWideChar(p, (LPSTR)caption); //strlen(caption)+1
|
||||
nchar = nCopyAnsiToWideChar(p, (LPSTR)caption, TRUE); //strlen(caption)+1
|
||||
p += nchar;
|
||||
|
||||
*p++ = 0; // advance pointer over nExtraStuff WORD - 2 more
|
||||
@@ -7517,11 +7516,13 @@ lpwAlign(
|
||||
* parameter as wide character (16-bits / char) string, and returns integer
|
||||
* number of wide characters (words) in string (including the trailing wide
|
||||
* char NULL). Partly taken from the Win32SDK samples.
|
||||
*/
|
||||
* If "use_enc" is TRUE, 'encoding' is used for "lpAnsiIn". If FALSE, current
|
||||
* ACP is used for "lpAnsiIn". */
|
||||
static int
|
||||
nCopyAnsiToWideChar(
|
||||
LPWORD lpWCStr,
|
||||
LPSTR lpAnsiIn)
|
||||
LPSTR lpAnsiIn,
|
||||
BOOL use_enc)
|
||||
{
|
||||
int nChar = 0;
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -7529,7 +7530,7 @@ nCopyAnsiToWideChar(
|
||||
int i;
|
||||
WCHAR *wn;
|
||||
|
||||
if (enc_codepage == 0 && (int)GetACP() != enc_codepage)
|
||||
if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
/* Not a codepage, use our own conversion function. */
|
||||
wn = enc_to_utf16((char_u *)lpAnsiIn, NULL);
|
||||
@@ -7852,8 +7853,8 @@ gui_mch_tearoff(
|
||||
|
||||
/* copy the title of the dialog */
|
||||
nchar = nCopyAnsiToWideChar(p, ((*title)
|
||||
? (LPSTR)title
|
||||
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)));
|
||||
? (LPSTR)title
|
||||
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
|
||||
p += nchar;
|
||||
|
||||
if (s_usenewlook)
|
||||
@@ -7865,13 +7866,13 @@ gui_mch_tearoff(
|
||||
/* point size */
|
||||
*p++ = -MulDiv(lfSysmenu.lfHeight, 72,
|
||||
GetDeviceCaps(hdc, LOGPIXELSY));
|
||||
nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName));
|
||||
nchar = nCopyAnsiToWideChar(p, lfSysmenu.lfFaceName, FALSE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*p++ = DLG_FONT_POINT_SIZE; // point size
|
||||
nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
|
||||
nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
|
||||
}
|
||||
p += nchar;
|
||||
}
|
||||
|
||||
+1
-1
@@ -891,7 +891,7 @@ static int ensure_ruby_initialized(void)
|
||||
#ifdef RUBY19_OR_LATER
|
||||
{
|
||||
int dummy_argc = 2;
|
||||
char *dummy_argv[] = {"vim-ruby", "-e0"};
|
||||
char *dummy_argv[] = {"vim-ruby", "-e_=0"};
|
||||
ruby_options(dummy_argc, dummy_argv);
|
||||
}
|
||||
ruby_script("vim-ruby");
|
||||
|
||||
@@ -25,12 +25,13 @@ static const VTermColor ansi_colors[] = {
|
||||
};
|
||||
|
||||
static int ramp6[] = {
|
||||
0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF,
|
||||
0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF,
|
||||
};
|
||||
|
||||
/* Use 0x81 instead of 0x80 to be able to distinguish from ansi black */
|
||||
static int ramp24[] = {
|
||||
0x00, 0x0B, 0x16, 0x21, 0x2C, 0x37, 0x42, 0x4D, 0x58, 0x63, 0x6E, 0x79,
|
||||
0x85, 0x90, 0x9B, 0xA6, 0xB1, 0xBC, 0xC7, 0xD2, 0xDD, 0xE8, 0xF3, 0xFF,
|
||||
0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76,
|
||||
0x81, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE,
|
||||
};
|
||||
|
||||
static int lookup_colour_ansi(const VTermState *state, long index, VTermColor *col)
|
||||
|
||||
+15
@@ -2648,6 +2648,21 @@ check_tty(mparm_T *parmp)
|
||||
#if defined(WIN3264) && !defined(FEAT_GUI_W32)
|
||||
if (is_cygpty_used())
|
||||
{
|
||||
# if defined(FEAT_MBYTE) && defined(HAVE_BIND_TEXTDOMAIN_CODESET) \
|
||||
&& defined(FEAT_GETTEXT)
|
||||
char *s, *tofree = NULL;
|
||||
|
||||
/* Set the encoding of the error message based on $LC_ALL or
|
||||
* other environment variables instead of 'encoding'.
|
||||
* Note that the message is shown on a Cygwin terminal (e.g.
|
||||
* mintty) which encoding is based on $LC_ALL or etc., not the
|
||||
* current codepage used by normal Win32 console programs. */
|
||||
tofree = s = enc_locale_env(NULL);
|
||||
if (s == NULL)
|
||||
s = "utf-8"; /* Use "utf-8" by default. */
|
||||
(void)bind_textdomain_codeset(VIMPACKAGE, s);
|
||||
vim_free(tofree);
|
||||
# endif
|
||||
mch_errmsg(_("Vim: Error: This version of Vim does not run in a Cygwin terminal\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+51
-31
@@ -4385,45 +4385,31 @@ enc_alias_search(char_u *name)
|
||||
|
||||
#if defined(FEAT_MBYTE) || defined(PROTO)
|
||||
|
||||
#ifdef HAVE_LANGINFO_H
|
||||
# include <langinfo.h>
|
||||
#endif
|
||||
# ifdef HAVE_LANGINFO_H
|
||||
# include <langinfo.h>
|
||||
# endif
|
||||
|
||||
# ifndef FEAT_GUI_W32
|
||||
/*
|
||||
* Get the canonicalized encoding of the current locale.
|
||||
* Get the canonicalized encoding from the specified locale string "locale"
|
||||
* or from the environment variables LC_ALL, LC_CTYPE and LANG.
|
||||
* Returns an allocated string when successful, NULL when not.
|
||||
*/
|
||||
char_u *
|
||||
enc_locale(void)
|
||||
enc_locale_env(char *locale)
|
||||
{
|
||||
#ifndef WIN3264
|
||||
char *s;
|
||||
char *s = locale;
|
||||
char *p;
|
||||
int i;
|
||||
#endif
|
||||
char buf[50];
|
||||
#ifdef WIN3264
|
||||
long acp = GetACP();
|
||||
|
||||
if (acp == 1200)
|
||||
STRCPY(buf, "ucs-2le");
|
||||
else if (acp == 1252) /* cp1252 is used as latin1 */
|
||||
STRCPY(buf, "latin1");
|
||||
else
|
||||
sprintf(buf, "cp%ld", acp);
|
||||
#else
|
||||
# ifdef HAVE_NL_LANGINFO_CODESET
|
||||
if ((s = nl_langinfo(CODESET)) == NULL || *s == NUL)
|
||||
# endif
|
||||
# if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
|
||||
if ((s = setlocale(LC_CTYPE, NULL)) == NULL || *s == NUL)
|
||||
# endif
|
||||
if ((s = getenv("LC_ALL")) == NULL || *s == NUL)
|
||||
if ((s = getenv("LC_CTYPE")) == NULL || *s == NUL)
|
||||
s = getenv("LANG");
|
||||
|
||||
if (s == NULL || *s == NUL)
|
||||
return FAIL;
|
||||
if ((s = getenv("LC_ALL")) == NULL || *s == NUL)
|
||||
if ((s = getenv("LC_CTYPE")) == NULL || *s == NUL)
|
||||
s = getenv("LANG");
|
||||
|
||||
if (s == NULL || *s == NUL)
|
||||
return NULL;
|
||||
|
||||
/* The most generic locale format is:
|
||||
* language[_territory][.codeset][@modifier][+special][,[sponsor][_revision]]
|
||||
@@ -4458,12 +4444,46 @@ enc_locale(void)
|
||||
break;
|
||||
}
|
||||
buf[i] = NUL;
|
||||
#endif
|
||||
|
||||
return enc_canonize((char_u *)buf);
|
||||
}
|
||||
# endif
|
||||
|
||||
#if defined(WIN3264) || defined(PROTO) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
|
||||
/*
|
||||
* Get the canonicalized encoding of the current locale.
|
||||
* Returns an allocated string when successful, NULL when not.
|
||||
*/
|
||||
char_u *
|
||||
enc_locale(void)
|
||||
{
|
||||
# ifdef WIN3264
|
||||
char buf[50];
|
||||
long acp = GetACP();
|
||||
|
||||
if (acp == 1200)
|
||||
STRCPY(buf, "ucs-2le");
|
||||
else if (acp == 1252) /* cp1252 is used as latin1 */
|
||||
STRCPY(buf, "latin1");
|
||||
else
|
||||
sprintf(buf, "cp%ld", acp);
|
||||
|
||||
return enc_canonize((char_u *)buf);
|
||||
# else
|
||||
char *s;
|
||||
|
||||
# ifdef HAVE_NL_LANGINFO_CODESET
|
||||
if ((s = nl_langinfo(CODESET)) == NULL || *s == NUL)
|
||||
# endif
|
||||
# if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
|
||||
if ((s = setlocale(LC_CTYPE, NULL)) == NULL || *s == NUL)
|
||||
# endif
|
||||
s = NULL;
|
||||
|
||||
return enc_locale_env(s);
|
||||
# endif
|
||||
}
|
||||
|
||||
# if defined(WIN3264) || defined(PROTO) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
|
||||
/*
|
||||
* Convert an encoding name to an MS-Windows codepage.
|
||||
* Returns zero if no codepage can be figured out.
|
||||
@@ -4490,7 +4510,7 @@ encname2codepage(char_u *name)
|
||||
return cp;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
# if defined(USE_ICONV) || defined(PROTO)
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ int mb_lefthalve(int row, int col);
|
||||
int mb_fix_col(int col, int row);
|
||||
char_u *enc_skip(char_u *p);
|
||||
char_u *enc_canonize(char_u *enc);
|
||||
char_u *enc_locale_env(char *locale);
|
||||
char_u *enc_locale(void);
|
||||
int encname2codepage(char_u *name);
|
||||
void *my_iconv_open(char_u *to, char_u *from);
|
||||
|
||||
+14
-9
@@ -4620,7 +4620,7 @@ current_quote(
|
||||
|
||||
#endif /* FEAT_TEXTOBJ */
|
||||
|
||||
static int is_one_char(char_u *pattern, int move, pos_T *cur);
|
||||
static int is_one_char(char_u *pattern, int move, pos_T *cur, int direction);
|
||||
|
||||
/*
|
||||
* Find next search match under cursor, cursor at end.
|
||||
@@ -4641,6 +4641,7 @@ current_search(
|
||||
int flags = 0;
|
||||
pos_T save_VIsual = VIsual;
|
||||
int one_char;
|
||||
int direction = forward ? FORWARD : BACKWARD;
|
||||
|
||||
/* wrapping should not occur */
|
||||
p_ws = FALSE;
|
||||
@@ -4667,8 +4668,10 @@ current_search(
|
||||
else
|
||||
orig_pos = pos = curwin->w_cursor;
|
||||
|
||||
/* Is the pattern is zero-width? */
|
||||
one_char = is_one_char(spats[last_idx].pat, TRUE, &curwin->w_cursor);
|
||||
/* Is the pattern is zero-width?, this time, don't care about the direction
|
||||
*/
|
||||
one_char = is_one_char(spats[last_idx].pat, TRUE, &curwin->w_cursor,
|
||||
FORWARD);
|
||||
if (one_char == -1)
|
||||
{
|
||||
p_ws = old_p_ws;
|
||||
@@ -4727,11 +4730,11 @@ current_search(
|
||||
}
|
||||
|
||||
start_pos = pos;
|
||||
flags = forward ? SEARCH_END : 0;
|
||||
flags = forward ? SEARCH_END : SEARCH_START;
|
||||
|
||||
/* Check again from the current cursor position,
|
||||
* since the next match might actually by only one char wide */
|
||||
one_char = is_one_char(spats[last_idx].pat, FALSE, &pos);
|
||||
one_char = is_one_char(spats[last_idx].pat, FALSE, &pos, direction);
|
||||
if (one_char < 0)
|
||||
/* search failed, abort */
|
||||
return FAIL;
|
||||
@@ -4739,7 +4742,7 @@ current_search(
|
||||
/* move to match, except for zero-width matches, in which case, we are
|
||||
* already on the next match */
|
||||
if (!one_char)
|
||||
result = searchit(curwin, curbuf, &pos, (forward ? FORWARD : BACKWARD),
|
||||
result = searchit(curwin, curbuf, &pos, direction,
|
||||
spats[last_idx].pat, 0L, flags | SEARCH_KEEP, RE_SEARCH, 0,
|
||||
NULL, NULL);
|
||||
|
||||
@@ -4788,10 +4791,11 @@ current_search(
|
||||
* Check if the pattern is one character long or zero-width.
|
||||
* If move is TRUE, check from the beginning of the buffer, else from position
|
||||
* "cur".
|
||||
* "direction" is FORWARD or BACKWARD.
|
||||
* Returns TRUE, FALSE or -1 for failure.
|
||||
*/
|
||||
static int
|
||||
is_one_char(char_u *pattern, int move, pos_T *cur)
|
||||
is_one_char(char_u *pattern, int move, pos_T *cur, int direction)
|
||||
{
|
||||
regmmatch_T regmatch;
|
||||
int nmatched = 0;
|
||||
@@ -4821,7 +4825,7 @@ is_one_char(char_u *pattern, int move, pos_T *cur)
|
||||
flag = SEARCH_START;
|
||||
}
|
||||
|
||||
if (searchit(curwin, curbuf, &pos, FORWARD, pattern, 1,
|
||||
if (searchit(curwin, curbuf, &pos, direction, pattern, 1,
|
||||
SEARCH_KEEP + flag, RE_SEARCH, 0, NULL, NULL) != FAIL)
|
||||
{
|
||||
/* Zero-width pattern should match somewhere, then we can check if
|
||||
@@ -4834,7 +4838,8 @@ is_one_char(char_u *pattern, int move, pos_T *cur)
|
||||
pos.lnum, regmatch.startpos[0].col, NULL, NULL);
|
||||
if (!nmatched)
|
||||
break;
|
||||
} while (regmatch.startpos[0].col < pos.col);
|
||||
} while (direction == FORWARD ? regmatch.startpos[0].col < pos.col
|
||||
: regmatch.startpos[0].col > pos.col);
|
||||
|
||||
if (!called_emsg)
|
||||
{
|
||||
|
||||
+3
-3
@@ -7970,9 +7970,9 @@ do_highlight(
|
||||
}
|
||||
else if (STRCMP(key, "GUIFG") == 0)
|
||||
{
|
||||
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
|
||||
char_u **namep = &HL_TABLE()[idx].sg_gui_fg_name;
|
||||
|
||||
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
|
||||
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
|
||||
{
|
||||
if (!init)
|
||||
@@ -8020,9 +8020,9 @@ do_highlight(
|
||||
}
|
||||
else if (STRCMP(key, "GUIBG") == 0)
|
||||
{
|
||||
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
|
||||
char_u **namep = &HL_TABLE()[idx].sg_gui_bg_name;
|
||||
|
||||
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
|
||||
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
|
||||
{
|
||||
if (!init)
|
||||
@@ -8070,9 +8070,9 @@ do_highlight(
|
||||
}
|
||||
else if (STRCMP(key, "GUISP") == 0)
|
||||
{
|
||||
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
|
||||
char_u **namep = &HL_TABLE()[idx].sg_gui_sp_name;
|
||||
|
||||
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
|
||||
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
|
||||
{
|
||||
if (!init)
|
||||
|
||||
+30
-12
@@ -41,10 +41,12 @@
|
||||
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
|
||||
* Higashi, 2017 Sep 19)
|
||||
* - Shift-Tab does not work.
|
||||
* - click in Window toolbar of other window: save/restore Insert and Visual
|
||||
* - double click in Window toolbar starts Visual mode.
|
||||
* - Redirecting output does not work on MS-Windows, Test_terminal_redir_file()
|
||||
* is disabled.
|
||||
* - cursor blinks in terminal on widows with a timer. (xtal8, #2142)
|
||||
* - implement term_setsize()
|
||||
* - MS-Windows GUI: WinBar has tearoff item
|
||||
* - MS-Windows GUI: still need to type a key after shell exits? #1924
|
||||
* - add test for giving error for invalid 'termsize' value.
|
||||
* - support minimal size when 'termsize' is "rows*cols".
|
||||
@@ -1796,23 +1798,38 @@ color2index(VTermColor *color, int fg, int *boldp)
|
||||
{
|
||||
if (red == blue && red == green)
|
||||
{
|
||||
/* 24-color greyscale */
|
||||
/* 24-color greyscale plus white and black */
|
||||
static int cutoff[23] = {
|
||||
0x05, 0x10, 0x1B, 0x26, 0x31, 0x3C, 0x47, 0x52,
|
||||
0x5D, 0x68, 0x73, 0x7F, 0x8A, 0x95, 0xA0, 0xAB,
|
||||
0xB6, 0xC1, 0xCC, 0xD7, 0xE2, 0xED, 0xF9};
|
||||
0x0D, 0x17, 0x21, 0x2B, 0x35, 0x3F, 0x49, 0x53, 0x5D, 0x67,
|
||||
0x71, 0x7B, 0x85, 0x8F, 0x99, 0xA3, 0xAD, 0xB7, 0xC1, 0xCB,
|
||||
0xD5, 0xDF, 0xE9};
|
||||
int i;
|
||||
|
||||
if (red < 5)
|
||||
return 17; /* 00/00/00 */
|
||||
if (red > 245) /* ff/ff/ff */
|
||||
return 232;
|
||||
for (i = 0; i < 23; ++i)
|
||||
if (red < cutoff[i])
|
||||
return i + 233;
|
||||
return 256;
|
||||
}
|
||||
{
|
||||
static int cutoff[5] = {0x2F, 0x73, 0x9B, 0xC3, 0xEB};
|
||||
int ri, gi, bi;
|
||||
|
||||
/* 216-color cube */
|
||||
return 17 + ((red + 25) / 0x33) * 36
|
||||
+ ((green + 25) / 0x33) * 6
|
||||
+ (blue + 25) / 0x33;
|
||||
/* 216-color cube */
|
||||
for (ri = 0; ri < 5; ++ri)
|
||||
if (red < cutoff[ri])
|
||||
break;
|
||||
for (gi = 0; gi < 5; ++gi)
|
||||
if (green < cutoff[gi])
|
||||
break;
|
||||
for (bi = 0; bi < 5; ++bi)
|
||||
if (blue < cutoff[bi])
|
||||
break;
|
||||
return 17 + ri * 36 + gi * 6 + bi;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2431,16 +2448,17 @@ static VTermColor ansi_table[16] = {
|
||||
};
|
||||
|
||||
static int cube_value[] = {
|
||||
0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF,
|
||||
0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF
|
||||
};
|
||||
|
||||
static int grey_ramp[] = {
|
||||
0x00, 0x0B, 0x16, 0x21, 0x2C, 0x37, 0x42, 0x4D, 0x58, 0x63, 0x6E, 0x79,
|
||||
0x85, 0x90, 0x9B, 0xA6, 0xB1, 0xBC, 0xC7, 0xD2, 0xDD, 0xE8, 0xF3, 0xFF,
|
||||
0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76,
|
||||
0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert a cterm color number 0 - 255 to RGB.
|
||||
* This is compatible with xterm.
|
||||
*/
|
||||
static void
|
||||
cterm_color2rgb(int nr, VTermColor *rgb)
|
||||
|
||||
@@ -420,7 +420,7 @@ func Test_setting_cursor()
|
||||
new Xtest2
|
||||
put =range(1,100)
|
||||
wq
|
||||
|
||||
|
||||
tabe Xtest2
|
||||
$
|
||||
diffsp Xtest1
|
||||
@@ -501,7 +501,7 @@ func Test_diffpatch()
|
||||
3
|
||||
+ 4
|
||||
.
|
||||
saveas Xpatch
|
||||
saveas! Xpatch
|
||||
bwipe!
|
||||
new
|
||||
call assert_fails('diffpatch Xpatch', 'E816:')
|
||||
@@ -547,6 +547,47 @@ func Test_diff_nomodifiable()
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_diff_hlID()
|
||||
new
|
||||
call setline(1, [1, 2, 3])
|
||||
diffthis
|
||||
vnew
|
||||
call setline(1, ['1x', 2, 'x', 3])
|
||||
diffthis
|
||||
redraw
|
||||
|
||||
call assert_equal(synIDattr(diff_hlID(-1, 1), "name"), "")
|
||||
|
||||
call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
|
||||
call assert_equal(synIDattr(diff_hlID(1, 2), "name"), "DiffText")
|
||||
call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
|
||||
call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "DiffAdd")
|
||||
call assert_equal(synIDattr(diff_hlID(4, 1), "name"), "")
|
||||
|
||||
wincmd w
|
||||
call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
|
||||
call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
|
||||
call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "")
|
||||
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_diff_filler()
|
||||
new
|
||||
call setline(1, [1, 2, 3, 'x', 4])
|
||||
diffthis
|
||||
vnew
|
||||
call setline(1, [1, 2, 'y', 'y', 3, 4])
|
||||
diffthis
|
||||
redraw
|
||||
|
||||
call assert_equal([0, 0, 0, 0, 0, 0, 0, 1, 0], map(range(-1, 7), 'diff_filler(v:val)'))
|
||||
wincmd w
|
||||
call assert_equal([0, 0, 0, 0, 2, 0, 0, 0], map(range(-1, 6), 'diff_filler(v:val)'))
|
||||
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_diff_lastline()
|
||||
enew!
|
||||
only!
|
||||
|
||||
@@ -314,6 +314,33 @@ func! Test_edit_11()
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
func! Test_edit_11_indentexpr()
|
||||
" Test that indenting kicks in
|
||||
new
|
||||
" Use indentexpr instead of cindenting
|
||||
func! Do_Indent()
|
||||
let pline=prevnonblank(v:lnum)
|
||||
if empty(getline(v:lnum))
|
||||
if getline(pline) =~ 'if\|then'
|
||||
return shiftwidth()
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunc
|
||||
setl indentexpr=Do_Indent() indentkeys+=0=then,0=fi
|
||||
call setline(1, ['if [ $this ]'])
|
||||
call cursor(1, 1)
|
||||
call feedkeys("othen\<cr>that\<cr>fi", 'tnix')
|
||||
call assert_equal(['if [ $this ]', "then", "\<tab>that", "fi"], getline(1, '$'))
|
||||
set cinkeys&vim indentkeys&vim
|
||||
set nocindent indentexpr=
|
||||
delfu Do_Indent
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
func! Test_edit_12()
|
||||
" Test changing indent in replace mode
|
||||
new
|
||||
|
||||
@@ -111,6 +111,15 @@ func Test_gn_command()
|
||||
call assert_equal(['foo baz'], getline(1,'$'))
|
||||
sil! %d_
|
||||
|
||||
" search upwards with nowrapscan set
|
||||
call setline('.', ['foo', 'bar', 'foo', 'baz'])
|
||||
set nowrapscan
|
||||
let @/='foo'
|
||||
$
|
||||
norm! dgN
|
||||
call assert_equal(['foo', 'bar', '', 'baz'], getline(1,'$'))
|
||||
sil! %d_
|
||||
|
||||
set wrapscan&vim
|
||||
set belloff&vim
|
||||
endfu
|
||||
|
||||
@@ -263,3 +263,27 @@ func Test_default_term()
|
||||
call assert_match("defaulting to 'ansi'", out)
|
||||
let $TERM = save_term
|
||||
endfunc
|
||||
|
||||
func Test_zzz_startinsert()
|
||||
" Test :startinsert
|
||||
call writefile(['123456'], 'Xtestout')
|
||||
let after = [
|
||||
\ ':startinsert',
|
||||
\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
|
||||
\ ]
|
||||
if RunVim([], after, 'Xtestout')
|
||||
let lines = readfile('Xtestout')
|
||||
call assert_equal(['foobar123456'], lines)
|
||||
endif
|
||||
" Test :startinsert!
|
||||
call writefile(['123456'], 'Xtestout')
|
||||
let after = [
|
||||
\ ':startinsert!',
|
||||
\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
|
||||
\ ]
|
||||
if RunVim([], after, 'Xtestout')
|
||||
let lines = readfile('Xtestout')
|
||||
call assert_equal(['123456foobar'], lines)
|
||||
endif
|
||||
call delete('Xtestout')
|
||||
endfunc
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
" Script to generate a file that shows al 256 xterm colors
|
||||
|
||||
new
|
||||
call setline(1, 'ANSI')
|
||||
|
||||
" ANSI colors
|
||||
let s = ''
|
||||
for nr in range(0, 7)
|
||||
let s .= "\033[4" . nr . "m "
|
||||
endfor
|
||||
for nr in range(8, 15)
|
||||
let s .= "\033[10" . (nr - 8) . "m "
|
||||
endfor
|
||||
let s .= "\033[107m|"
|
||||
call setline(2, s)
|
||||
|
||||
" 6 x 6 x 6 color cube
|
||||
call setline(3, 'color cube')
|
||||
for high in range(0, 5)
|
||||
let s = ''
|
||||
for low in range(0, 35)
|
||||
let nr = low + high * 36
|
||||
let s .= "\033[48;5;" . (nr + 16) . "m "
|
||||
endfor
|
||||
let s .= "\033[107m|"
|
||||
call setline(high + 4, s)
|
||||
endfor
|
||||
|
||||
" 24 shades of grey
|
||||
call setline(10, 'grey ramp')
|
||||
let s = ''
|
||||
for nr in range(0, 23)
|
||||
let s .= "\033[48;5;" . (nr + 232) . "m "
|
||||
endfor
|
||||
let s .= "\033[107m|"
|
||||
call setline(11, s)
|
||||
|
||||
set binary
|
||||
write! <sfile>:h/xterm_ramp.txt
|
||||
quit
|
||||
@@ -776,6 +776,24 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1155,
|
||||
/**/
|
||||
1154,
|
||||
/**/
|
||||
1153,
|
||||
/**/
|
||||
1152,
|
||||
/**/
|
||||
1151,
|
||||
/**/
|
||||
1150,
|
||||
/**/
|
||||
1149,
|
||||
/**/
|
||||
1148,
|
||||
/**/
|
||||
1147,
|
||||
/**/
|
||||
1146,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user