mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b667ee0c63 | |||
| 1fcce8d536 | |||
| 1043467482 | |||
| 23a5558cfd | |||
| 75c19464ed | |||
| 9abccb9a5c | |||
| 24f8f543d4 | |||
| 913727e567 | |||
| 5f761f85d8 | |||
| f1f6f3f7df | |||
| 31eb139b88 | |||
| 399c297aa9 | |||
| 8cc2a9c062 | |||
| 4d8505155e | |||
| 190b04cdd9 | |||
| a9f8ffb634 | |||
| 43dded8c59 | |||
| dad7309dd2 | |||
| a76f59d817 | |||
| 9235d12894 | |||
| 65189a1294 | |||
| 6f785749db | |||
| 88989cc381 | |||
| 544d3bc9f0 | |||
| 78f80e21cb | |||
| 13c724fb3a | |||
| 059b7482a2 | |||
| 2f9e575583 | |||
| 955f198fc5 | |||
| e971df39a5 | |||
| aaaf57d8a9 | |||
| c11c152316 | |||
| 1fb0d49803 | |||
| a1891848d9 | |||
| e353c402e6 | |||
| 698f8b207b | |||
| 25ea054458 | |||
| 6b40f30329 | |||
| cbf20fbcd3 |
@@ -1,3 +1,5 @@
|
||||
" Load the matchit package.
|
||||
" For those users who were loading the matchit plugin from here.
|
||||
packadd matchit
|
||||
if 1
|
||||
packadd matchit
|
||||
endif
|
||||
|
||||
+30
-14
@@ -1,7 +1,7 @@
|
||||
" Set options and add mapping such that Vim behaves a lot like MS-Windows
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last change: 2012 Jul 25
|
||||
" Last change: 2017 Feb 09
|
||||
|
||||
" bail out if this isn't wanted (mrsvim.vim uses this).
|
||||
if exists("g:skip_loading_mswin") && g:skip_loading_mswin
|
||||
@@ -23,20 +23,22 @@ set backspace=indent,eol,start whichwrap+=<,>,[,]
|
||||
" backspace in Visual mode deletes selection
|
||||
vnoremap <BS> d
|
||||
|
||||
" CTRL-X and SHIFT-Del are Cut
|
||||
vnoremap <C-X> "+x
|
||||
vnoremap <S-Del> "+x
|
||||
if has("clipboard")
|
||||
" CTRL-X and SHIFT-Del are Cut
|
||||
vnoremap <C-X> "+x
|
||||
vnoremap <S-Del> "+x
|
||||
|
||||
" CTRL-C and CTRL-Insert are Copy
|
||||
vnoremap <C-C> "+y
|
||||
vnoremap <C-Insert> "+y
|
||||
" CTRL-C and CTRL-Insert are Copy
|
||||
vnoremap <C-C> "+y
|
||||
vnoremap <C-Insert> "+y
|
||||
|
||||
" CTRL-V and SHIFT-Insert are Paste
|
||||
map <C-V> "+gP
|
||||
map <S-Insert> "+gP
|
||||
" CTRL-V and SHIFT-Insert are Paste
|
||||
map <C-V> "+gP
|
||||
map <S-Insert> "+gP
|
||||
|
||||
cmap <C-V> <C-R>+
|
||||
cmap <S-Insert> <C-R>+
|
||||
cmap <C-V> <C-R>+
|
||||
cmap <S-Insert> <C-R>+
|
||||
endif
|
||||
|
||||
" Pasting blockwise and linewise selections is not possible in Insert and
|
||||
" Visual mode without the +virtualedit feature. They are pasted as if they
|
||||
@@ -44,8 +46,10 @@ cmap <S-Insert> <C-R>+
|
||||
" Uses the paste.vim autoload script.
|
||||
" Use CTRL-G u to have CTRL-Z only undo the paste.
|
||||
|
||||
exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']
|
||||
exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']
|
||||
if 1
|
||||
exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']
|
||||
exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']
|
||||
endif
|
||||
|
||||
imap <S-Insert> <C-V>
|
||||
vmap <S-Insert> <C-V>
|
||||
@@ -99,6 +103,18 @@ inoremap <C-F4> <C-O><C-W>c
|
||||
cnoremap <C-F4> <C-C><C-W>c
|
||||
onoremap <C-F4> <C-C><C-W>c
|
||||
|
||||
if has("gui")
|
||||
" CTRL-F is the search dialog
|
||||
noremap <C-F> :promptfind<CR>
|
||||
inoremap <C-F> <C-\><C-O>:promptfind<CR>
|
||||
cnoremap <C-F> <C-\><C-C>:promptfind<CR>
|
||||
|
||||
" CTRL-H is the replace dialog
|
||||
noremap <C-H> :promptrepl<CR>
|
||||
inoremap <C-H> <C-\><C-O>:promptrepl<CR>
|
||||
cnoremap <C-H> <C-\><C-C>:promptrepl<CR>
|
||||
endif
|
||||
|
||||
" restore 'cpoptions'
|
||||
set cpo&
|
||||
if 1
|
||||
|
||||
@@ -1255,7 +1255,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>126</string>
|
||||
<string>127</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
|
||||
+2
-2
@@ -2089,8 +2089,6 @@ test1 \
|
||||
test_getcwd \
|
||||
test_insertcount \
|
||||
test_listchars \
|
||||
test_listlbr \
|
||||
test_listlbr_utf8 \
|
||||
test_search_mbyte \
|
||||
test_wordcount \
|
||||
test3 test4 test5 test6 test7 test8 test9 \
|
||||
@@ -2165,6 +2163,8 @@ test_arglist \
|
||||
test_langmap \
|
||||
test_largefile \
|
||||
test_lispwords \
|
||||
test_listlbr \
|
||||
test_listlbr_utf8 \
|
||||
test_lua \
|
||||
test_man \
|
||||
test_mapping \
|
||||
|
||||
+27
-19
@@ -1861,39 +1861,42 @@ channel_save(channel_T *channel, ch_part_T part, char_u *buf, int len,
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to fill the buffer of "reader".
|
||||
* Returns FALSE when nothing was added.
|
||||
*/
|
||||
static int
|
||||
channel_fill(js_read_T *reader)
|
||||
{
|
||||
channel_T *channel = (channel_T *)reader->js_cookie;
|
||||
ch_part_T part = reader->js_cookie_arg;
|
||||
char_u *next = channel_get(channel, part);
|
||||
int unused;
|
||||
int len;
|
||||
int keeplen;
|
||||
int addlen;
|
||||
char_u *p;
|
||||
|
||||
if (next == NULL)
|
||||
return FALSE;
|
||||
|
||||
unused = reader->js_end - reader->js_buf - reader->js_used;
|
||||
if (unused > 0)
|
||||
keeplen = reader->js_end - reader->js_buf;
|
||||
if (keeplen > 0)
|
||||
{
|
||||
/* Prepend unused text. */
|
||||
len = (int)STRLEN(next);
|
||||
p = alloc(unused + len + 1);
|
||||
addlen = (int)STRLEN(next);
|
||||
p = alloc(keeplen + addlen + 1);
|
||||
if (p == NULL)
|
||||
{
|
||||
vim_free(next);
|
||||
return FALSE;
|
||||
}
|
||||
mch_memmove(p, reader->js_buf + reader->js_used, unused);
|
||||
mch_memmove(p + unused, next, len + 1);
|
||||
mch_memmove(p, reader->js_buf, keeplen);
|
||||
mch_memmove(p + keeplen, next, addlen + 1);
|
||||
vim_free(next);
|
||||
next = p;
|
||||
}
|
||||
|
||||
vim_free(reader->js_buf);
|
||||
reader->js_buf = next;
|
||||
reader->js_used = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1973,16 +1976,20 @@ channel_parse_json(channel_T *channel, ch_part_T part)
|
||||
}
|
||||
|
||||
if (status == OK)
|
||||
chanpart->ch_waiting = FALSE;
|
||||
chanpart->ch_wait_len = 0;
|
||||
else if (status == MAYBE)
|
||||
{
|
||||
if (!chanpart->ch_waiting)
|
||||
size_t buflen = STRLEN(reader.js_buf);
|
||||
|
||||
if (chanpart->ch_wait_len < buflen)
|
||||
{
|
||||
/* First time encountering incomplete message, set a deadline of
|
||||
* 100 msec. */
|
||||
ch_log(channel, "Incomplete message - wait for more");
|
||||
/* First time encountering incomplete message or after receiving
|
||||
* more (but still incomplete): set a deadline of 100 msec. */
|
||||
ch_logn(channel,
|
||||
"Incomplete message (%d bytes) - wait 100 msec for more",
|
||||
buflen);
|
||||
reader.js_used = 0;
|
||||
chanpart->ch_waiting = TRUE;
|
||||
chanpart->ch_wait_len = buflen;
|
||||
#ifdef WIN32
|
||||
chanpart->ch_deadline = GetTickCount() + 100L;
|
||||
#else
|
||||
@@ -2013,7 +2020,8 @@ channel_parse_json(channel_T *channel, ch_part_T part)
|
||||
if (timeout)
|
||||
{
|
||||
status = FAIL;
|
||||
chanpart->ch_waiting = FALSE;
|
||||
chanpart->ch_wait_len = 0;
|
||||
ch_log(channel, "timed out");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2027,7 +2035,7 @@ channel_parse_json(channel_T *channel, ch_part_T part)
|
||||
{
|
||||
ch_error(channel, "Decoding failed - discarding input");
|
||||
ret = FALSE;
|
||||
chanpart->ch_waiting = FALSE;
|
||||
chanpart->ch_wait_len = 0;
|
||||
}
|
||||
else if (reader.js_buf[reader.js_used] != NUL)
|
||||
{
|
||||
@@ -3394,7 +3402,7 @@ channel_read_json_block(
|
||||
/* Wait for up to the timeout. If there was an incomplete message
|
||||
* use the deadline for that. */
|
||||
timeout = timeout_arg;
|
||||
if (chanpart->ch_waiting)
|
||||
if (chanpart->ch_wait_len > 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
timeout = chanpart->ch_deadline - GetTickCount() + 1;
|
||||
@@ -3414,7 +3422,7 @@ channel_read_json_block(
|
||||
{
|
||||
/* Something went wrong, channel_parse_json() didn't
|
||||
* discard message. Cancel waiting. */
|
||||
chanpart->ch_waiting = FALSE;
|
||||
chanpart->ch_wait_len = 0;
|
||||
timeout = timeout_arg;
|
||||
}
|
||||
else if (timeout > timeout_arg)
|
||||
|
||||
@@ -1296,6 +1296,10 @@ getvcol(
|
||||
posptr = NULL; /* continue until the NUL */
|
||||
else
|
||||
{
|
||||
/* Special check for an empty line, which can happen on exit, when
|
||||
* ml_get_buf() always returns an empty string. */
|
||||
if (*ptr == NUL)
|
||||
pos->col = 0;
|
||||
posptr = ptr + pos->col;
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
|
||||
+21
@@ -138,6 +138,23 @@ diff_buf_add(buf_T *buf)
|
||||
EMSGN(_("E96: Cannot diff more than %ld buffers"), DB_COUNT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove all buffers to make diffs for.
|
||||
*/
|
||||
static void
|
||||
diff_buf_clear(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < DB_COUNT; ++i)
|
||||
if (curtab->tp_diffbuf[i] != NULL)
|
||||
{
|
||||
curtab->tp_diffbuf[i] = NULL;
|
||||
curtab->tp_diff_invalid = TRUE;
|
||||
diff_redraw(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find buffer "buf" in the list of diff buffers for the current tab page.
|
||||
* Return its index or DB_COUNT if not found.
|
||||
@@ -1257,6 +1274,10 @@ ex_diffoff(exarg_T *eap)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Also remove hidden buffers from the list. */
|
||||
if (eap->forceit)
|
||||
diff_buf_clear();
|
||||
|
||||
#ifdef FEAT_SCROLLBIND
|
||||
/* Remove "hor" from from 'scrollopt' if there are no diff windows left. */
|
||||
if (!diffwin && vim_strchr(p_sbo, 'h') != NULL)
|
||||
|
||||
+5
-2
@@ -3476,10 +3476,13 @@ ins_compl_bs(void)
|
||||
mb_ptr_back(line, p);
|
||||
|
||||
/* Stop completion when the whole word was deleted. For Omni completion
|
||||
* allow the word to be deleted, we won't match everything. */
|
||||
* allow the word to be deleted, we won't match everything.
|
||||
* Respect the 'backspace' option. */
|
||||
if ((int)(p - line) - (int)compl_col < 0
|
||||
|| ((int)(p - line) - (int)compl_col == 0
|
||||
&& ctrl_x_mode != CTRL_X_OMNI) || ctrl_x_mode == CTRL_X_EVAL)
|
||||
&& ctrl_x_mode != CTRL_X_OMNI) || ctrl_x_mode == CTRL_X_EVAL
|
||||
|| (!can_bs(BS_START) && (int)(p - line) - (int)compl_col
|
||||
- compl_length < 0))
|
||||
return K_BS;
|
||||
|
||||
/* Deleted more than what was used to find matches or didn't finish
|
||||
|
||||
+6
-4
@@ -6503,18 +6503,20 @@ find_help_tags(
|
||||
static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
|
||||
"/*", "/\\*", "\"*", "**",
|
||||
"cpo-*", "/\\(\\)", "/\\%(\\)",
|
||||
"?", ":?", "?<CR>", "g?", "g?g?", "g??", "z?",
|
||||
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
|
||||
"/\\?", "/\\z(\\)", "\\=", ":s\\=",
|
||||
"[count]", "[quotex]", "[range]",
|
||||
"[count]", "[quotex]",
|
||||
"[range]", ":[range]",
|
||||
"[pattern]", "\\|", "\\%$",
|
||||
"s/\\~", "s/\\U", "s/\\L",
|
||||
"s/\\1", "s/\\2", "s/\\3", "s/\\9"};
|
||||
static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
|
||||
"/star", "/\\\\star", "quotestar", "starstar",
|
||||
"cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)",
|
||||
"?", ":?", "?<CR>", "g?", "g?g?", "g??", "z?",
|
||||
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
|
||||
"/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
|
||||
"\\[count]", "\\[quotex]", "\\[range]",
|
||||
"\\[count]", "\\[quotex]",
|
||||
"\\[range]", ":\\[range]",
|
||||
"\\[pattern]", "\\\\bar", "/\\\\%\\$",
|
||||
"s/\\\\\\~", "s/\\\\U", "s/\\\\L",
|
||||
"s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
|
||||
|
||||
+20
-13
@@ -3582,6 +3582,9 @@ add_pack_plugin(char_u *fname, void *cookie)
|
||||
size_t afterlen = 0;
|
||||
char_u *ffname = fix_fname(fname);
|
||||
size_t fname_len;
|
||||
char_u *buf = NULL;
|
||||
char_u *rtp_ffname;
|
||||
int match;
|
||||
|
||||
if (ffname == NULL)
|
||||
return;
|
||||
@@ -3606,26 +3609,28 @@ add_pack_plugin(char_u *fname, void *cookie)
|
||||
/* Find "ffname" in "p_rtp", ignoring '/' vs '\' differences. */
|
||||
fname_len = STRLEN(ffname);
|
||||
insp = p_rtp;
|
||||
for (;;)
|
||||
buf = alloc(MAXPATHL);
|
||||
if (buf == NULL)
|
||||
goto theend;
|
||||
while (*insp != NUL)
|
||||
{
|
||||
if (vim_fnamencmp(insp, ffname, fname_len) == 0)
|
||||
copy_option_part(&insp, buf, MAXPATHL, ",");
|
||||
add_pathsep(buf);
|
||||
rtp_ffname = fix_fname(buf);
|
||||
if (rtp_ffname == NULL)
|
||||
goto theend;
|
||||
match = vim_fnamencmp(rtp_ffname, ffname, fname_len) == 0;
|
||||
vim_free(rtp_ffname);
|
||||
if (match)
|
||||
break;
|
||||
insp = vim_strchr(insp, ',');
|
||||
if (insp == NULL)
|
||||
break;
|
||||
++insp;
|
||||
}
|
||||
|
||||
if (insp == NULL)
|
||||
if (*insp == NUL)
|
||||
/* not found, append at the end */
|
||||
insp = p_rtp + STRLEN(p_rtp);
|
||||
else
|
||||
{
|
||||
/* append after the matching directory. */
|
||||
insp += STRLEN(ffname);
|
||||
while (*insp != NUL && *insp != ',')
|
||||
++insp;
|
||||
}
|
||||
--insp;
|
||||
*p4 = c;
|
||||
|
||||
/* check if rtp/pack/name/start/name/after exists */
|
||||
@@ -3635,7 +3640,8 @@ add_pack_plugin(char_u *fname, void *cookie)
|
||||
|
||||
oldlen = STRLEN(p_rtp);
|
||||
addlen = STRLEN(ffname) + 1; /* add one for comma */
|
||||
new_rtp = alloc((int)(oldlen + addlen + afterlen + 1)); /* add one for NUL */
|
||||
new_rtp = alloc((int)(oldlen + addlen + afterlen + 1));
|
||||
/* add one for NUL */
|
||||
if (new_rtp == NULL)
|
||||
goto theend;
|
||||
keep = (int)(insp - p_rtp);
|
||||
@@ -3689,6 +3695,7 @@ add_pack_plugin(char_u *fname, void *cookie)
|
||||
}
|
||||
|
||||
theend:
|
||||
vim_free(buf);
|
||||
vim_free(ffname);
|
||||
}
|
||||
|
||||
|
||||
+12
-5
@@ -2302,8 +2302,8 @@ do_one_cmd(
|
||||
if (!ea.skip)
|
||||
{
|
||||
curwin->w_cursor.lnum = ea.line2;
|
||||
/* don't leave the cursor on an illegal line */
|
||||
check_cursor_lnum();
|
||||
/* don't leave the cursor on an illegal line or column */
|
||||
check_cursor();
|
||||
}
|
||||
}
|
||||
else if (*ea.cmd != ',')
|
||||
@@ -2497,7 +2497,7 @@ do_one_cmd(
|
||||
&& !IS_USER_CMDIDX(ea.cmdidx))
|
||||
{
|
||||
/* Command not allowed when editing the command line. */
|
||||
errormsg = get_text_locked_msg();
|
||||
errormsg = (char_u *)_(get_text_locked_msg());
|
||||
goto doend;
|
||||
}
|
||||
#ifdef FEAT_AUTOCMD
|
||||
@@ -4374,9 +4374,16 @@ skip_range(
|
||||
{
|
||||
unsigned delim;
|
||||
|
||||
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL)
|
||||
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL)
|
||||
{
|
||||
if (*cmd == '\'')
|
||||
if (*cmd == '\\')
|
||||
{
|
||||
if (cmd[1] == '?' || cmd[1] == '/' || cmd[1] == '&')
|
||||
++cmd;
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if (*cmd == '\'')
|
||||
{
|
||||
if (*++cmd == NUL && ctx != NULL)
|
||||
*ctx = EXPAND_NOTHING;
|
||||
|
||||
+1
-2
@@ -212,8 +212,7 @@ getcmdline(
|
||||
#endif
|
||||
expand_T xpc;
|
||||
long *b_im_ptr = NULL;
|
||||
#if defined(FEAT_WILDMENU) || defined(FEAT_EVAL) \
|
||||
|| defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CMDWIN)
|
||||
#if defined(FEAT_WILDMENU) || defined(FEAT_EVAL) || defined(FEAT_SEARCH_EXTRA)
|
||||
/* Everything that may work recursively should save and restore the
|
||||
* current command line in save_ccline. That includes update_screen(), a
|
||||
* custom status line may invoke ":normal". */
|
||||
|
||||
+1
-1
@@ -1585,7 +1585,7 @@ EXTERN char_u e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than
|
||||
EXTERN char_u e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'"));
|
||||
#endif
|
||||
EXTERN char_u e_write[] INIT(= N_("E80: Error while writing"));
|
||||
EXTERN char_u e_zerocount[] INIT(= N_("Zero count"));
|
||||
EXTERN char_u e_zerocount[] INIT(= N_("E939: Positive count required"));
|
||||
#ifdef FEAT_EVAL
|
||||
EXTERN char_u e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context"));
|
||||
#endif
|
||||
|
||||
@@ -1476,6 +1476,8 @@ gui_resize_shell(int pixel_width, int pixel_height)
|
||||
}
|
||||
|
||||
again:
|
||||
new_pixel_width = 0;
|
||||
new_pixel_height = 0;
|
||||
busy = TRUE;
|
||||
|
||||
/* Flush pending output before redrawing */
|
||||
@@ -1485,8 +1487,8 @@ again:
|
||||
gui.num_rows = (pixel_height - gui_get_base_height()) / gui.char_height;
|
||||
|
||||
gui_position_components(pixel_width);
|
||||
|
||||
gui_reset_scroll_region();
|
||||
|
||||
/*
|
||||
* At the "more" and ":confirm" prompt there is no redraw, put the cursor
|
||||
* at the last line here (why does it have to be one row too low?).
|
||||
@@ -1508,17 +1510,22 @@ again:
|
||||
|
||||
busy = FALSE;
|
||||
|
||||
/*
|
||||
* We could have been called again while redrawing the screen.
|
||||
* Need to do it all again with the latest size then.
|
||||
*/
|
||||
/* We may have been called again while redrawing the screen.
|
||||
* Need to do it all again with the latest size then. But only if the size
|
||||
* actually changed. */
|
||||
if (new_pixel_height)
|
||||
{
|
||||
pixel_width = new_pixel_width;
|
||||
pixel_height = new_pixel_height;
|
||||
new_pixel_width = 0;
|
||||
new_pixel_height = 0;
|
||||
goto again;
|
||||
if (pixel_width == new_pixel_width && pixel_height == new_pixel_height)
|
||||
{
|
||||
new_pixel_width = 0;
|
||||
new_pixel_height = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixel_width = new_pixel_width;
|
||||
pixel_height = new_pixel_height;
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1528,18 +1535,10 @@ again:
|
||||
void
|
||||
gui_may_resize_shell(void)
|
||||
{
|
||||
int h, w;
|
||||
|
||||
if (new_pixel_height)
|
||||
{
|
||||
/* careful: gui_resize_shell() may postpone the resize again if we
|
||||
* were called indirectly by it */
|
||||
w = new_pixel_width;
|
||||
h = new_pixel_height;
|
||||
new_pixel_width = 0;
|
||||
new_pixel_height = 0;
|
||||
gui_resize_shell(w, h);
|
||||
}
|
||||
gui_resize_shell(new_pixel_width, new_pixel_height);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
+1
-1
@@ -863,7 +863,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
|
||||
&& cur_item != NULL)
|
||||
{
|
||||
top_item->jd_key = get_tv_string_buf_chk(cur_item, key_buf);
|
||||
if (top_item->jd_key == NULL || *top_item->jd_key == NUL)
|
||||
if (top_item->jd_key == NULL)
|
||||
{
|
||||
clear_tv(cur_item);
|
||||
EMSG(_(e_invarg));
|
||||
|
||||
@@ -1187,6 +1187,10 @@ main_loop(
|
||||
skip_redraw = FALSE;
|
||||
else if (do_redraw || stuff_empty())
|
||||
{
|
||||
# ifdef FEAT_GUI
|
||||
/* If ui_breakcheck() was used a resize may have been postponed. */
|
||||
gui_may_resize_shell();
|
||||
# endif
|
||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
|
||||
/* Trigger CursorMoved if the cursor moved. */
|
||||
if (!finish_op && (
|
||||
|
||||
+31
-2
@@ -9084,6 +9084,34 @@ nv_edit(cmdarg_T *cap)
|
||||
/* drop the pasted text */
|
||||
bracketed_paste(PASTE_INSERT, TRUE, NULL);
|
||||
}
|
||||
else if (cap->cmdchar == K_PS && VIsual_active)
|
||||
{
|
||||
pos_T old_pos = curwin->w_cursor;
|
||||
pos_T old_visual = VIsual;
|
||||
|
||||
/* In Visual mode the selected text is deleted. */
|
||||
if (VIsual_mode == 'V' || curwin->w_cursor.lnum != VIsual.lnum)
|
||||
{
|
||||
shift_delete_registers();
|
||||
cap->oap->regname = '1';
|
||||
}
|
||||
else
|
||||
cap->oap->regname = '-';
|
||||
cap->cmdchar = 'd';
|
||||
cap->nchar = NUL;
|
||||
nv_operator(cap);
|
||||
do_pending_operator(cap, 0, FALSE);
|
||||
cap->cmdchar = K_PS;
|
||||
|
||||
/* When the last char in the line was deleted then append. Detect this
|
||||
* by checking if the cursor moved to before the Visual area. */
|
||||
if (*ml_get_cursor() != NUL && lt(curwin->w_cursor, old_pos)
|
||||
&& lt(curwin->w_cursor, old_visual))
|
||||
inc_cursor();
|
||||
|
||||
/* Insert to replace the deleted text with the pasted text. */
|
||||
invoke_edit(cap, FALSE, cap->cmdchar, FALSE);
|
||||
}
|
||||
else if (!checkclearopq(cap->oap))
|
||||
{
|
||||
switch (cap->cmdchar)
|
||||
@@ -9113,8 +9141,9 @@ nv_edit(cmdarg_T *cap)
|
||||
beginline(BL_WHITE|BL_FIX);
|
||||
break;
|
||||
|
||||
case K_PS: /* Bracketed paste works like "a"ppend, unless the
|
||||
cursor is in the first column, then it inserts. */
|
||||
case K_PS:
|
||||
/* Bracketed paste works like "a"ppend, unless the cursor is in
|
||||
* the first column, then it inserts. */
|
||||
if (curwin->w_cursor.col == 0)
|
||||
break;
|
||||
/*FALLTHROUGH*/
|
||||
|
||||
@@ -1627,6 +1627,22 @@ adjust_clip_reg(int *rp)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Shift the delete registers: "9 is cleared, "8 becomes "9, etc.
|
||||
*/
|
||||
void
|
||||
shift_delete_registers()
|
||||
{
|
||||
int n;
|
||||
|
||||
y_current = &y_regs[9];
|
||||
free_yank_all(); /* free register nine */
|
||||
for (n = 9; n > 1; --n)
|
||||
y_regs[n] = y_regs[n - 1];
|
||||
y_previous = y_current = &y_regs[1];
|
||||
y_regs[1].y_array = NULL; /* set register one to empty */
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle a delete operation.
|
||||
*
|
||||
@@ -1739,12 +1755,7 @@ op_delete(oparg_T *oap)
|
||||
if (orig_regname != 0 || oap->motion_type == MLINE
|
||||
|| oap->line_count > 1 || oap->use_reg_one)
|
||||
{
|
||||
y_current = &y_regs[9];
|
||||
free_yank_all(); /* free register nine */
|
||||
for (n = 9; n > 1; --n)
|
||||
y_regs[n] = y_regs[n - 1];
|
||||
y_previous = y_current = &y_regs[1];
|
||||
y_regs[1].y_array = NULL; /* set register one to empty */
|
||||
shift_delete_registers();
|
||||
if (op_yank(oap, TRUE, FALSE) == OK)
|
||||
did_yank = TRUE;
|
||||
}
|
||||
|
||||
+58
-3
@@ -5043,7 +5043,7 @@ do_set(
|
||||
if (flags & P_FLAGLIST)
|
||||
{
|
||||
/* Remove flags that appear twice. */
|
||||
for (s = newval; *s; ++s)
|
||||
for (s = newval; *s;)
|
||||
{
|
||||
/* if options have P_FLAGLIST and
|
||||
* P_ONECOMMA such as 'whichwrap' */
|
||||
@@ -5055,7 +5055,7 @@ do_set(
|
||||
/* Remove the duplicated value and
|
||||
* the next comma. */
|
||||
STRMOVE(s, s + 2);
|
||||
s -= 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -5064,9 +5064,10 @@ do_set(
|
||||
&& vim_strchr(s + 1, *s) != NULL)
|
||||
{
|
||||
STRMOVE(s, s + 1);
|
||||
--s;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
++s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9380,7 +9381,35 @@ get_option_value(
|
||||
|
||||
opt_idx = findoption(name);
|
||||
if (opt_idx < 0) /* unknown option */
|
||||
{
|
||||
int key;
|
||||
|
||||
if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
|
||||
&& (key = find_key_option(name)) != 0)
|
||||
{
|
||||
char_u key_name[2];
|
||||
char_u *p;
|
||||
|
||||
if (key < 0)
|
||||
{
|
||||
key_name[0] = KEY2TERMCAP0(key);
|
||||
key_name[1] = KEY2TERMCAP1(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
key_name[0] = KS_KEY;
|
||||
key_name[1] = (key & 0xff);
|
||||
}
|
||||
p = find_termcode(key_name);
|
||||
if (p != NULL)
|
||||
{
|
||||
if (stringval != NULL)
|
||||
*stringval = vim_strsave(p);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -3;
|
||||
}
|
||||
|
||||
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
|
||||
|
||||
@@ -9638,7 +9667,33 @@ set_option_value(
|
||||
|
||||
opt_idx = findoption(name);
|
||||
if (opt_idx < 0)
|
||||
{
|
||||
int key;
|
||||
|
||||
if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
|
||||
&& (key = find_key_option(name)) != 0)
|
||||
{
|
||||
char_u key_name[2];
|
||||
|
||||
if (key < 0)
|
||||
{
|
||||
key_name[0] = KEY2TERMCAP0(key);
|
||||
key_name[1] = KEY2TERMCAP1(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
key_name[0] = KS_KEY;
|
||||
key_name[1] = (key & 0xff);
|
||||
}
|
||||
add_termcode(key_name, string, FALSE);
|
||||
if (full_screen)
|
||||
ttest(FALSE);
|
||||
redraw_all_later(CLEAR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EMSG2(_("E355: Unknown option: %s"), name);
|
||||
}
|
||||
else
|
||||
{
|
||||
flags = options[opt_idx].flags;
|
||||
|
||||
@@ -889,6 +889,8 @@ mch_early_init(void)
|
||||
void
|
||||
mch_exit(int r)
|
||||
{
|
||||
exiting = TRUE;
|
||||
|
||||
if (raw_in) /* put terminal in 'normal' mode */
|
||||
{
|
||||
settmode(TMODE_COOK);
|
||||
|
||||
@@ -201,6 +201,8 @@ int _stricoll(char *a, char *b)
|
||||
void
|
||||
mch_exit(int r)
|
||||
{
|
||||
exiting = TRUE;
|
||||
|
||||
display_errors();
|
||||
|
||||
ml_close_all(TRUE); /* remove all memfiles */
|
||||
|
||||
+2
-1
@@ -2538,8 +2538,9 @@ mch_init(void)
|
||||
void
|
||||
mch_exit(int r)
|
||||
{
|
||||
stoptermcap();
|
||||
exiting = TRUE;
|
||||
|
||||
stoptermcap();
|
||||
if (g_fWindInitCalled)
|
||||
settmode(TMODE_COOK);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ int insert_reg(int regname, int literally);
|
||||
int get_spec_reg(int regname, char_u **argp, int *allocated, int errmsg);
|
||||
int cmdline_paste_reg(int regname, int literally, int remcr);
|
||||
void adjust_clip_reg(int *rp);
|
||||
void shift_delete_registers(void);
|
||||
int op_delete(oparg_T *oap);
|
||||
int op_replace(oparg_T *oap, int c);
|
||||
void op_tilde(oparg_T *oap);
|
||||
|
||||
@@ -1595,6 +1595,9 @@ spell_read_tree(
|
||||
len = get4c(fd);
|
||||
if (len < 0)
|
||||
return SP_TRUNCERROR;
|
||||
if (len >= 0x3ffffff)
|
||||
/* Invalid length, multiply with sizeof(int) would overflow. */
|
||||
return SP_FORMERROR;
|
||||
if (len > 0)
|
||||
{
|
||||
/* Allocate the byte array. */
|
||||
|
||||
+5
-3
@@ -1566,9 +1566,11 @@ typedef struct {
|
||||
jsonq_T ch_json_head; /* header for circular json read queue */
|
||||
int ch_block_id; /* ID that channel_read_json_block() is
|
||||
waiting for */
|
||||
/* When ch_waiting is TRUE use ch_deadline to wait for incomplete message
|
||||
* to be complete. */
|
||||
int ch_waiting;
|
||||
/* When ch_wait_len is non-zero use ch_deadline to wait for incomplete
|
||||
* message to be complete. The value is the length of the incomplete
|
||||
* message when the deadline was set. If it gets longer (something was
|
||||
* received) the deadline is reset. */
|
||||
size_t ch_wait_len;
|
||||
#ifdef WIN32
|
||||
DWORD ch_deadline;
|
||||
#else
|
||||
|
||||
@@ -82,7 +82,6 @@ SCRIPTS_ALL = \
|
||||
test_getcwd.out \
|
||||
test_insertcount.out \
|
||||
test_listchars.out \
|
||||
test_listlbr.out \
|
||||
test_search_mbyte.out \
|
||||
test_wordcount.out
|
||||
|
||||
@@ -101,8 +100,7 @@ SCRIPTS_MORE2 = \
|
||||
test12.out \
|
||||
test25.out \
|
||||
test49.out \
|
||||
test97.out \
|
||||
test_listlbr_utf8.out
|
||||
test97.out
|
||||
|
||||
|
||||
# Tests that run on most systems, but not MingW and Cygwin.
|
||||
@@ -164,6 +162,8 @@ NEW_TESTS = test_arglist.res \
|
||||
test_job_fails.res \
|
||||
test_json.res \
|
||||
test_langmap.res \
|
||||
test_listlbr.res \
|
||||
test_listlbr_utf8.res \
|
||||
test_lua.res \
|
||||
test_man.res \
|
||||
test_marks.res \
|
||||
|
||||
@@ -7,3 +7,25 @@ func Test_no_type_checking()
|
||||
let v = 3.4
|
||||
let v = 'hello'
|
||||
endfunc
|
||||
|
||||
func Test_let_termcap()
|
||||
" Terminal code
|
||||
let old_t_te = &t_te
|
||||
let &t_te = "\<Esc>[yes;"
|
||||
call assert_match('t_te.*^[[yes;', execute("set termcap"))
|
||||
let &t_te = old_t_te
|
||||
|
||||
if !has('gui_running')
|
||||
" Key code
|
||||
let old_t_k1 = &t_k1
|
||||
let &t_k1 = "that"
|
||||
call assert_match('t_k1.*that', execute("set termcap"))
|
||||
let &t_k1 = old_t_k1
|
||||
endif
|
||||
|
||||
call assert_fails('let x = &t_xx', 'E15')
|
||||
let &t_xx = "yes"
|
||||
call assert_equal("yes", &t_xx)
|
||||
let &t_xx = ""
|
||||
call assert_fails('let x = &t_xx', 'E15')
|
||||
endfunc
|
||||
|
||||
@@ -2,171 +2,209 @@
|
||||
"
|
||||
" Note: if you get strange failures when adding new tests, it might be that
|
||||
" while the test is run, the breakindent cacheing gets in its way.
|
||||
" It helps to change the tabastop setting and force a redraw (e.g. see
|
||||
" It helps to change the tabstop setting and force a redraw (e.g. see
|
||||
" Test_breakindent08())
|
||||
if !exists('+breakindent')
|
||||
finish
|
||||
endif
|
||||
|
||||
source view_util.vim
|
||||
|
||||
let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP"
|
||||
|
||||
function s:screenline(lnum, width) abort
|
||||
" always get 4 screen lines
|
||||
redraw!
|
||||
let line = []
|
||||
for j in range(3)
|
||||
for c in range(1, a:width)
|
||||
call add(line, nr2char(screenchar(a:lnum+j, c)))
|
||||
endfor
|
||||
call add(line, "\n")
|
||||
endfor
|
||||
return join(line, '')
|
||||
function s:screen_lines(lnum, width) abort
|
||||
return ScreenLines([a:lnum, a:lnum + 2], a:width)
|
||||
endfunction
|
||||
|
||||
function s:testwindows(...)
|
||||
10new
|
||||
vsp
|
||||
vert resize 20
|
||||
setl ts=4 sw=4 sts=4 breakindent
|
||||
function! s:compare_lines(expect, actual)
|
||||
call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
|
||||
endfunction
|
||||
|
||||
function s:test_windows(...)
|
||||
call NewWindow(10, 20)
|
||||
setl ts=4 sw=4 sts=4 breakindent
|
||||
put =s:input
|
||||
if a:0
|
||||
exe a:1
|
||||
endif
|
||||
exe get(a:000, 0, '')
|
||||
endfunction
|
||||
|
||||
function s:close_windows(...)
|
||||
bw!
|
||||
if a:0
|
||||
exe a:1
|
||||
endif
|
||||
unlet! g:line g:expect
|
||||
call CloseWindow()
|
||||
exe get(a:000, 0, '')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent01()
|
||||
" simple breakindent test
|
||||
call s:testwindows('setl briopt=min:0')
|
||||
let g:line=s:screenline(line('.'),8)
|
||||
let g:expect=" abcd\n qrst\n GHIJ\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=min:0')
|
||||
let lines=s:screen_lines(line('.'),8)
|
||||
let expect=[
|
||||
\ " abcd",
|
||||
\ " qrst",
|
||||
\ " GHIJ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunction
|
||||
|
||||
function Test_breakindent02()
|
||||
" simple breakindent test with showbreak set
|
||||
call s:testwindows('setl briopt=min:0 sbr=>>')
|
||||
let g:line=s:screenline(line('.'),8)
|
||||
let g:expect=" abcd\n >>qr\n >>EF\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=min:0 sbr=>>')
|
||||
let lines=s:screen_lines(line('.'),8)
|
||||
let expect=[
|
||||
\ " abcd",
|
||||
\ " >>qr",
|
||||
\ " >>EF",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows('set sbr=')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent03()
|
||||
" simple breakindent test with showbreak set and briopt including sbr
|
||||
call s:testwindows('setl briopt=sbr,min:0 sbr=++')
|
||||
let g:line=s:screenline(line('.'),8)
|
||||
let g:expect=" abcd\n++ qrst\n++ GHIJ\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=sbr,min:0 sbr=++')
|
||||
let lines=s:screen_lines(line('.'),8)
|
||||
let expect=[
|
||||
\ " abcd",
|
||||
\ "++ qrst",
|
||||
\ "++ GHIJ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
" clean up
|
||||
call s:close_windows('set sbr=')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent04()
|
||||
" breakindent set with min width 18
|
||||
call s:testwindows('setl sbr= briopt=min:18')
|
||||
let g:line=s:screenline(line('.'),8)
|
||||
let g:expect=" abcd\n qrstuv\n IJKLMN\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl sbr= briopt=min:18')
|
||||
let lines=s:screen_lines(line('.'),8)
|
||||
let expect=[
|
||||
\ " abcd",
|
||||
\ " qrstuv",
|
||||
\ " IJKLMN",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
" clean up
|
||||
call s:close_windows('set sbr=')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent05()
|
||||
" breakindent set and shift by 2
|
||||
call s:testwindows('setl briopt=shift:2,min:0')
|
||||
let g:line=s:screenline(line('.'),8)
|
||||
let g:expect=" abcd\n qr\n EF\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=shift:2,min:0')
|
||||
let lines=s:screen_lines(line('.'),8)
|
||||
let expect=[
|
||||
\ " abcd",
|
||||
\ " qr",
|
||||
\ " EF",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunction
|
||||
|
||||
function Test_breakindent06()
|
||||
" breakindent set and shift by -1
|
||||
call s:testwindows('setl briopt=shift:-1,min:0')
|
||||
let g:line=s:screenline(line('.'),8)
|
||||
let g:expect=" abcd\n qrstu\n HIJKL\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=shift:-1,min:0')
|
||||
let lines=s:screen_lines(line('.'),8)
|
||||
let expect=[
|
||||
\ " abcd",
|
||||
\ " qrstu",
|
||||
\ " HIJKL",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunction
|
||||
|
||||
function Test_breakindent07()
|
||||
" breakindent set and shift by 1, Number set sbr=? and briopt:sbr
|
||||
call s:testwindows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n')
|
||||
let g:line=s:screenline(line('.'),10)
|
||||
let g:expect=" 2 ab\n? m\n? x\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n')
|
||||
let lines=s:screen_lines(line('.'),10)
|
||||
let expect=[
|
||||
\ " 2 ab",
|
||||
\ "? m",
|
||||
\ "? x",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
" clean up
|
||||
call s:close_windows('set sbr= cpo-=n')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent07a()
|
||||
" breakindent set and shift by 1, Number set sbr=? and briopt:sbr
|
||||
call s:testwindows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4')
|
||||
let g:line=s:screenline(line('.'),10)
|
||||
let g:expect=" 2 ab\n ? m\n ? x\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4')
|
||||
let lines=s:screen_lines(line('.'),10)
|
||||
let expect=[
|
||||
\ " 2 ab",
|
||||
\ " ? m",
|
||||
\ " ? x",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
" clean up
|
||||
call s:close_windows('set sbr=')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent08()
|
||||
" breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr
|
||||
call s:testwindows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4')
|
||||
call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4')
|
||||
" make sure, cache is invalidated!
|
||||
set ts=8
|
||||
redraw!
|
||||
set ts=4
|
||||
redraw!
|
||||
let g:line=s:screenline(line('.'),10)
|
||||
let g:expect=" 2 ^Iabcd\n# opq\n# BCD\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
let lines=s:screen_lines(line('.'),10)
|
||||
let expect=[
|
||||
\ " 2 ^Iabcd",
|
||||
\ "# opq",
|
||||
\ "# BCD",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows('set sbr= cpo-=n')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent08a()
|
||||
" breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr
|
||||
call s:testwindows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list')
|
||||
let g:line=s:screenline(line('.'),10)
|
||||
let g:expect=" 2 ^Iabcd\n # opq\n # BCD\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list')
|
||||
let lines=s:screen_lines(line('.'),10)
|
||||
let expect=[
|
||||
\ " 2 ^Iabcd",
|
||||
\ " # opq",
|
||||
\ " # BCD",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows('set sbr=')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent09()
|
||||
" breakindent set and shift by 1, Number and list set sbr=#
|
||||
call s:testwindows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list')
|
||||
let g:line=s:screenline(line('.'),10)
|
||||
let g:expect=" 2 ^Iabcd\n #op\n #AB\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list')
|
||||
let lines=s:screen_lines(line('.'),10)
|
||||
let expect=[
|
||||
\ " 2 ^Iabcd",
|
||||
\ " #op",
|
||||
\ " #AB",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows('set sbr=')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent10()
|
||||
" breakindent set, Number set sbr=~
|
||||
call s:testwindows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0')
|
||||
call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0')
|
||||
" make sure, cache is invalidated!
|
||||
set ts=8
|
||||
redraw!
|
||||
set ts=4
|
||||
redraw!
|
||||
let g:line=s:screenline(line('.'),10)
|
||||
let g:expect=" 2 ab\n~ mn\n~ yz\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
let lines=s:screen_lines(line('.'),10)
|
||||
let expect=[
|
||||
\ " 2 ab",
|
||||
\ "~ mn",
|
||||
\ "~ yz",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows('set sbr= cpo-=n')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent11()
|
||||
" test strdisplaywidth()
|
||||
call s:testwindows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4')
|
||||
call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4')
|
||||
let text=getline(2)
|
||||
let width = strlen(text[1:])+indent(2)+strlen(&sbr)*3 " text wraps 3 times
|
||||
call assert_equal(width, strdisplaywidth(text))
|
||||
@@ -176,16 +214,20 @@ endfunction
|
||||
function Test_breakindent12()
|
||||
" test breakindent with long indent
|
||||
let s:input="\t\t\t\t\t{"
|
||||
call s:testwindows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>-')
|
||||
let g:line=s:screenline(2,16)
|
||||
let g:expect=" 2 >--->--->--->\n ---{ \n~ \n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>-')
|
||||
let lines=s:screen_lines(2,16)
|
||||
let expect=[
|
||||
\ " 2 >--->--->--->",
|
||||
\ " ---{ ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows('set nuw=4 listchars=')
|
||||
endfunction
|
||||
|
||||
function Test_breakindent13()
|
||||
let s:input=""
|
||||
call s:testwindows('setl breakindent briopt=min:10 ts=8')
|
||||
call s:test_windows('setl breakindent briopt=min:10 ts=8')
|
||||
vert resize 20
|
||||
call setline(1, [" a\tb\tc\td\te", " z y x w v"])
|
||||
1
|
||||
@@ -199,26 +241,34 @@ endfunction
|
||||
|
||||
function Test_breakindent14()
|
||||
let s:input=""
|
||||
call s:testwindows('setl breakindent briopt= ts=8')
|
||||
call s:test_windows('setl breakindent briopt= ts=8')
|
||||
vert resize 30
|
||||
norm! 3a1234567890
|
||||
norm! a abcde
|
||||
exec "norm! 0\<C-V>tex"
|
||||
let g:line=s:screenline(line('.'),8)
|
||||
let g:expect="e \n~ \n~ \n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
let lines=s:screen_lines(line('.'),8)
|
||||
let expect=[
|
||||
\ "e ",
|
||||
\ "~ ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunction
|
||||
|
||||
function Test_breakindent15()
|
||||
let s:input=""
|
||||
call s:testwindows('setl breakindent briopt= ts=8 sw=8')
|
||||
call s:test_windows('setl breakindent briopt= ts=8 sw=8')
|
||||
vert resize 30
|
||||
norm! 4a1234567890
|
||||
exe "normal! >>\<C-V>3f0x"
|
||||
let g:line=s:screenline(line('.'),20)
|
||||
let g:expect=" 1234567890 \n~ \n~ \n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
let lines=s:screen_lines(line('.'),20)
|
||||
let expect=[
|
||||
\ " 1234567890 ",
|
||||
\ "~ ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunction
|
||||
|
||||
@@ -226,16 +276,24 @@ function Test_breakindent16()
|
||||
" Check that overlong lines are indented correctly.
|
||||
" TODO: currently it does not fail even when the bug is not fixed.
|
||||
let s:input=""
|
||||
call s:testwindows('setl breakindent briopt=min:0 ts=4')
|
||||
call s:test_windows('setl breakindent briopt=min:0 ts=4')
|
||||
call setline(1, "\t".repeat("1234567890", 10))
|
||||
resize 6
|
||||
norm! 1gg$
|
||||
redraw!
|
||||
let g:line=s:screenline(1,10)
|
||||
let g:expect=" 123456\n 789012\n 345678\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
let g:line=s:screenline(4,10)
|
||||
let g:expect=" 901234\n 567890\n 123456\n"
|
||||
call assert_equal(g:expect, g:line)
|
||||
let lines=s:screen_lines(1,10)
|
||||
let expect=[
|
||||
\ " 123456",
|
||||
\ " 789012",
|
||||
\ " 345678",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
let lines=s:screen_lines(4,10)
|
||||
let expect=[
|
||||
\ " 901234",
|
||||
\ " 567890",
|
||||
\ " 123456",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunction
|
||||
|
||||
@@ -1141,7 +1141,11 @@ func Test_out_cb()
|
||||
|
||||
let dict = {'thisis': 'dict: '}
|
||||
func dict.outHandler(chan, msg) dict
|
||||
let g:Ch_outmsg = self.thisis . a:msg
|
||||
if type(a:msg) == v:t_string
|
||||
let g:Ch_outmsg = self.thisis . a:msg
|
||||
else
|
||||
let g:Ch_outobj = a:msg
|
||||
endif
|
||||
endfunc
|
||||
func dict.errHandler(chan, msg) dict
|
||||
let g:Ch_errmsg = self.thisis . a:msg
|
||||
@@ -1161,6 +1165,12 @@ func Test_out_cb()
|
||||
call assert_equal("dict: hello", g:Ch_outmsg)
|
||||
call WaitFor('g:Ch_errmsg != ""')
|
||||
call assert_equal("dict: there", g:Ch_errmsg)
|
||||
|
||||
" Receive a json object split in pieces
|
||||
unlet! g:Ch_outobj
|
||||
call ch_sendraw(job, "echosplit [0, {\"one\": 1,| \"tw|o\": 2, \"three\": 3|}]\n")
|
||||
call WaitFor('exists("g:Ch_outobj")')
|
||||
call assert_equal({'one': 1, 'two': 2, 'three': 3}, g:Ch_outobj)
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
|
||||
@@ -29,6 +29,11 @@ if __name__ == "__main__":
|
||||
if typed.startswith("echo "):
|
||||
print(typed[5:-1])
|
||||
sys.stdout.flush()
|
||||
if typed.startswith("echosplit "):
|
||||
for part in typed[10:-1].split('|'):
|
||||
sys.stdout.write(part)
|
||||
sys.stdout.flush()
|
||||
time.sleep(0.05)
|
||||
if typed.startswith("double "):
|
||||
print(typed[7:-1] + "\nAND " + typed[7:-1])
|
||||
sys.stdout.flush()
|
||||
|
||||
@@ -289,13 +289,24 @@ func Test_remove_char_in_cmdline()
|
||||
call assert_equal('"def', @:)
|
||||
endfunc
|
||||
|
||||
func Test_illegal_address()
|
||||
func Test_illegal_address1()
|
||||
new
|
||||
2;'(
|
||||
2;')
|
||||
quit
|
||||
endfunc
|
||||
|
||||
func Test_illegal_address2()
|
||||
call writefile(['c', 'x', ' x', '.', '1;y'], 'Xtest.vim')
|
||||
new
|
||||
source Xtest.vim
|
||||
" Trigger calling validate_cursor()
|
||||
diffsp Xtest.vim
|
||||
quit!
|
||||
bwipe!
|
||||
call delete('Xtest.vim')
|
||||
endfunc
|
||||
|
||||
func Test_cmdline_complete_wildoptions()
|
||||
help
|
||||
call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx')
|
||||
@@ -306,3 +317,60 @@ func Test_cmdline_complete_wildoptions()
|
||||
call assert_equal(a, b)
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
" using a leading backslash here
|
||||
set cpo+=C
|
||||
|
||||
func Test_cmdline_search_range()
|
||||
new
|
||||
call setline(1, ['a', 'b', 'c', 'd'])
|
||||
/d
|
||||
1,\/s/b/B/
|
||||
call assert_equal('B', getline(2))
|
||||
|
||||
/a
|
||||
$
|
||||
\?,4s/c/C/
|
||||
call assert_equal('C', getline(3))
|
||||
|
||||
call setline(1, ['a', 'b', 'c', 'd'])
|
||||
%s/c/c/
|
||||
1,\&s/b/B/
|
||||
call assert_equal('B', getline(2))
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Tests for getcmdline(), getcmdpos() and getcmdtype()
|
||||
func Check_cmdline(cmdtype)
|
||||
call assert_equal('MyCmd a', getcmdline())
|
||||
call assert_equal(8, getcmdpos())
|
||||
call assert_equal(a:cmdtype, getcmdtype())
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
func Test_getcmdtype()
|
||||
call feedkeys(":MyCmd a\<C-R>=Check_cmdline(':')\<CR>\<Esc>", "xt")
|
||||
|
||||
let cmdtype = ''
|
||||
debuggreedy
|
||||
call feedkeys(":debug echo 'test'\<CR>", "t")
|
||||
call feedkeys("let cmdtype = \<C-R>=string(getcmdtype())\<CR>\<CR>", "t")
|
||||
call feedkeys("cont\<CR>", "xt")
|
||||
0debuggreedy
|
||||
call assert_equal('>', cmdtype)
|
||||
|
||||
call feedkeys("/MyCmd a\<C-R>=Check_cmdline('/')\<CR>\<Esc>", "xt")
|
||||
call feedkeys("?MyCmd a\<C-R>=Check_cmdline('?')\<CR>\<Esc>", "xt")
|
||||
|
||||
call feedkeys(":call input('Answer?')\<CR>", "t")
|
||||
call feedkeys("MyCmd a\<C-R>=Check_cmdline('@')\<CR>\<C-C>", "xt")
|
||||
|
||||
call feedkeys(":insert\<CR>MyCmd a\<C-R>=Check_cmdline('-')\<CR>\<Esc>", "xt")
|
||||
|
||||
cnoremap <expr> <F6> Check_cmdline('=')
|
||||
call feedkeys("a\<C-R>=MyCmd a\<F6>\<Esc>\<Esc>", "xt")
|
||||
cunmap <F6>
|
||||
endfunc
|
||||
|
||||
set cpo&
|
||||
|
||||
@@ -212,6 +212,7 @@ func Test_diffoff()
|
||||
call setline(1, ['One', '', 'Two', 'Three'])
|
||||
diffthis
|
||||
redraw
|
||||
call assert_notequal(normattr, screenattr(1, 1))
|
||||
diffoff!
|
||||
redraw
|
||||
call assert_equal(normattr, screenattr(1, 1))
|
||||
@@ -219,6 +220,42 @@ func Test_diffoff()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_diffoff_hidden()
|
||||
set diffopt=filler,foldcolumn:0
|
||||
e! one
|
||||
call setline(1, ['Two', 'Three'])
|
||||
let normattr = screenattr(1, 1)
|
||||
diffthis
|
||||
botright vert new two
|
||||
call setline(1, ['One', 'Four'])
|
||||
diffthis
|
||||
redraw
|
||||
call assert_notequal(normattr, screenattr(1, 1))
|
||||
set hidden
|
||||
close
|
||||
redraw
|
||||
" diffing with hidden buffer two
|
||||
call assert_notequal(normattr, screenattr(1, 1))
|
||||
diffoff
|
||||
redraw
|
||||
call assert_equal(normattr, screenattr(1, 1))
|
||||
diffthis
|
||||
redraw
|
||||
" still diffing with hidden buffer two
|
||||
call assert_notequal(normattr, screenattr(1, 1))
|
||||
diffoff!
|
||||
redraw
|
||||
call assert_equal(normattr, screenattr(1, 1))
|
||||
diffthis
|
||||
redraw
|
||||
" no longer diffing with hidden buffer two
|
||||
call assert_equal(normattr, screenattr(1, 1))
|
||||
|
||||
bwipe!
|
||||
bwipe!
|
||||
set hidden& diffopt&
|
||||
endfunc
|
||||
|
||||
func Test_setting_cursor()
|
||||
new Xtest1
|
||||
put =range(1,90)
|
||||
|
||||
@@ -320,39 +320,73 @@ func! Test_mode()
|
||||
normal! 3G
|
||||
exe "normal i\<F2>\<Esc>"
|
||||
call assert_equal('i-i', g:current_modes)
|
||||
" i_CTRL-P: Multiple matches
|
||||
exe "normal i\<C-G>uBa\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-P: Single match
|
||||
exe "normal iBro\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-X
|
||||
exe "normal iBa\<C-X>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ix', g:current_modes)
|
||||
" i_CTRL-X CTRL-P: Multiple matches
|
||||
exe "normal iBa\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-X CTRL-P: Single match
|
||||
exe "normal iBro\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-X CTRL-P + CTRL-P: Single match
|
||||
exe "normal iBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-X CTRL-L: Multiple matches
|
||||
exe "normal i\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-X CTRL-L: Single match
|
||||
exe "normal iBlu\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-P: No match
|
||||
exe "normal iCom\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-X CTRL-P: No match
|
||||
exe "normal iCom\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
" i_CTRL-X CTRL-L: No match
|
||||
exe "normal iabc\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||
call assert_equal('i-ic', g:current_modes)
|
||||
|
||||
" R_CTRL-P: Multiple matches
|
||||
exe "normal RBa\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-P: Single match
|
||||
exe "normal RBro\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-X
|
||||
exe "normal RBa\<C-X>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rx', g:current_modes)
|
||||
" R_CTRL-X CTRL-P: Multiple matches
|
||||
exe "normal RBa\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-X CTRL-P: Single match
|
||||
exe "normal RBro\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-X CTRL-P + CTRL-P: Single match
|
||||
exe "normal RBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-X CTRL-L: Multiple matches
|
||||
exe "normal R\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-X CTRL-L: Single match
|
||||
exe "normal RBlu\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-P: No match
|
||||
exe "normal RCom\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-X CTRL-P: No match
|
||||
exe "normal RCom\<C-X>\<C-P>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
" R_CTRL-X CTRL-L: No match
|
||||
exe "normal Rabc\<C-X>\<C-L>\<F2>\<Esc>u"
|
||||
call assert_equal('R-Rc', g:current_modes)
|
||||
|
||||
call assert_equal('n', mode(0))
|
||||
call assert_equal('n', mode(1))
|
||||
|
||||
+255
-1
@@ -4,6 +4,9 @@ if !has('gui') || ($DISPLAY == "" && !has('gui_running'))
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:x11_based_gui = has('gui_athena') || has('gui_motif')
|
||||
\ || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
|
||||
|
||||
" For KDE set a font, empty 'guifont' may cause a hang.
|
||||
func SetUp()
|
||||
if has("gui_kde")
|
||||
@@ -32,10 +35,261 @@ func Test_1_set_secure()
|
||||
call assert_equal(1, has('gui_running'))
|
||||
endfunc
|
||||
|
||||
func Test_getfontname_with_arg()
|
||||
if has('gui_athena') || has('gui_motif')
|
||||
" Invalid font name. The result should be an empty string.
|
||||
call assert_equal('', getfontname('notexist'))
|
||||
|
||||
" Valid font name. This is usually the real name of 7x13 by default.
|
||||
let l:fname = '-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1'
|
||||
call assert_equal(l:fname, getfontname(l:fname))
|
||||
|
||||
elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
|
||||
" Invalid font name. The result should be the name plus the default size.
|
||||
call assert_equal('notexist 10', getfontname('notexist'))
|
||||
|
||||
" Valid font name. This is usually the real name of Monospace by default.
|
||||
let l:fname = 'Bitstream Vera Sans Mono 12'
|
||||
call assert_equal(l:fname, getfontname(l:fname))
|
||||
else
|
||||
throw "Skipped: Matched font name unpredictable to test on this GUI"
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_getfontname_without_arg()
|
||||
let l:fname = getfontname()
|
||||
if has('gui_kde')
|
||||
" 'expected' is the value specified by SetUp() above.
|
||||
call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', l:fname)
|
||||
elseif has('gui_athena') || has('gui_motif')
|
||||
" 'expected' is DFLT_FONT of gui_x11.c.
|
||||
call assert_equal('7x13', l:fname)
|
||||
elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
|
||||
" 'expected' is DEFAULT_FONT of gui_gtk_x11.c.
|
||||
call assert_equal('Monospace 10', l:fname)
|
||||
else
|
||||
throw "Skipped: Default font name unpredictable to test on this GUI"
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_set_guifont()
|
||||
let l:guifont_saved = &guifont
|
||||
if has('xfontset')
|
||||
" Prevent 'guifontset' from canceling 'guifont'.
|
||||
let l:guifontset_saved = &guifontset
|
||||
set guifontset=
|
||||
endif
|
||||
|
||||
let skipped = 0
|
||||
if has('gui_athena') || has('gui_motif')
|
||||
" Non-empty font list with invalid font names.
|
||||
"
|
||||
" This test is twofold: (1) It checks if the command fails as expected
|
||||
" when there are no loadable fonts found in the list. (2) It checks if
|
||||
" 'guifont' remains the same after the command loads none of the fonts
|
||||
" listed.
|
||||
let l:flist = &guifont
|
||||
call assert_fails('set guifont=-notexist1-*,-notexist2-*')
|
||||
call assert_equal(l:flist, &guifont)
|
||||
|
||||
" Non-empty font list with a valid font name. Should pick up the first
|
||||
" valid font.
|
||||
set guifont=-notexist1-*,fixed,-notexist2-*
|
||||
call assert_equal('fixed', getfontname())
|
||||
|
||||
" Empty list. Should fallback to the built-in default.
|
||||
set guifont=
|
||||
call assert_equal('7x13', getfontname())
|
||||
|
||||
elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
|
||||
" For GTK, what we refer to as 'font names' in our manual are actually
|
||||
" 'initial font patterns'. A valid font which matches the 'canonical font
|
||||
" pattern' constructed from a given 'initial pattern' is to be looked up
|
||||
" and loaded. That explains why the GTK GUIs appear to accept 'invalid
|
||||
" font names'.
|
||||
"
|
||||
" Non-empty list. Should always pick up the first element, no matter how
|
||||
" strange it is, as explained above.
|
||||
set guifont=(´・ω・`)\ 12,Courier\ 12
|
||||
call assert_equal('(´・ω・`) 12', getfontname())
|
||||
|
||||
" Empty list. Should fallback to the built-in default.
|
||||
set guifont=
|
||||
call assert_equal('Monospace 10', getfontname())
|
||||
|
||||
else
|
||||
let skipped = 1
|
||||
endif
|
||||
|
||||
if has('xfontset')
|
||||
let &guifontset = l:guifontset_saved
|
||||
endif
|
||||
let &guifont = l:guifont_saved
|
||||
|
||||
if skipped
|
||||
throw "Skipped: Test not implemented yet for this GUI"
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_set_guifontset()
|
||||
let skipped = 0
|
||||
|
||||
if has('xfontset')
|
||||
let l:ctype_saved = v:ctype
|
||||
|
||||
" For UTF-8 locales, XCreateFontSet(3) is likely to fail in constructing a
|
||||
" fontset automatically from one or two simple XLFDs because it requires
|
||||
" the host system to have a fairly comprehensive collection of fixed-width
|
||||
" fonts with various sizes and registries/encodings in order to get the
|
||||
" job done. To make the test meaningful for a wide variety of hosts, we
|
||||
" confine ourselves to the following locale for which X11 historically has
|
||||
" the fonts to use with.
|
||||
language ctype ja_JP.eucJP
|
||||
|
||||
" Since XCreateFontSet(3) is very sensitive to locale, fonts must be
|
||||
" chosen meticulously.
|
||||
let l:font_head = '-misc-fixed-medium-r-normal--14'
|
||||
|
||||
let l:font_aw70 = l:font_head . '-130-75-75-c-70'
|
||||
let l:font_aw140 = l:font_head . '-130-75-75-c-140'
|
||||
|
||||
let l:font_jisx0201 = l:font_aw70 . '-jisx0201.1976-0'
|
||||
let l:font_jisx0208 = l:font_aw140 . '-jisx0208.1983-0'
|
||||
|
||||
" Full XLFDs
|
||||
let l:fontset_name = join([ l:font_jisx0208, l:font_jisx0201 ], ',')
|
||||
exec 'set guifontset=' . l:fontset_name
|
||||
call assert_equal(l:fontset_name, &guifontset)
|
||||
|
||||
" XLFDs w/o CharSetRegistry and CharSetEncoding
|
||||
let l:fontset_name = join([ l:font_aw140, l:font_aw70 ], ',')
|
||||
exec 'set guifontset=' . l:fontset_name
|
||||
call assert_equal(l:fontset_name, &guifontset)
|
||||
|
||||
" Singleton
|
||||
let l:fontset_name = l:font_head . '-*'
|
||||
exec 'set guifontset=' . l:fontset_name
|
||||
call assert_equal(l:fontset_name, &guifontset)
|
||||
|
||||
" Aliases
|
||||
let l:fontset_name = 'k14,r14'
|
||||
exec 'set guifontset=' . l:fontset_name
|
||||
call assert_equal(l:fontset_name, &guifontset)
|
||||
|
||||
exec 'language ctype' l:ctype_saved
|
||||
|
||||
else
|
||||
let skipped = 1
|
||||
endif
|
||||
|
||||
if skipped
|
||||
throw "Skipped: Not supported by this GUI"
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_set_guifontwide()
|
||||
let skipped = 0
|
||||
|
||||
if has('gui_gtk')
|
||||
let l:guifont_saved = &guifont
|
||||
let l:guifontwide_saved = &guifontwide
|
||||
|
||||
let l:fc_match = exepath('fc-match')
|
||||
if l:fc_match != ''
|
||||
let &guifont = system('fc-match -f "%{family[0]} %{size}" monospace:size=10')
|
||||
let l:wide = system('fc-match -f "%{family[0]} %{size}" monospace:size=10:lang=ja')
|
||||
exec 'set guifontwide=' . fnameescape(l:wide)
|
||||
call assert_equal(l:wide, &guifontwide)
|
||||
else
|
||||
let skipped = 3
|
||||
endif
|
||||
|
||||
let &guifontwide = l:guifontwide_saved
|
||||
let &guifont = l:guifont_saved
|
||||
|
||||
elseif has('gui_athena') || has('gui_motif')
|
||||
" guifontwide is premised upon the xfontset feature.
|
||||
if has('xfontset')
|
||||
let l:encoding_saved = &encoding
|
||||
let l:guifont_saved = &guifont
|
||||
let l:guifontset_saved = &guifontset
|
||||
let l:guifontwide_saved = &guifontwide
|
||||
|
||||
let l:nfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1'
|
||||
let l:wfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1'
|
||||
|
||||
set encoding=utf-8
|
||||
|
||||
" Case 1: guifontset is empty
|
||||
set guifontset=
|
||||
|
||||
" Case 1-1: Automatic selection
|
||||
set guifontwide=
|
||||
exec 'set guifont=' . l:nfont
|
||||
call assert_equal(l:wfont, &guifontwide)
|
||||
|
||||
" Case 1-2: Manual selection
|
||||
exec 'set guifontwide=' . l:wfont
|
||||
exec 'set guifont=' . l:nfont
|
||||
call assert_equal(l:wfont, &guifontwide)
|
||||
|
||||
" Case 2: guifontset is invalid
|
||||
try
|
||||
set guifontset=-*-notexist-*
|
||||
call assert_false(1, "'set guifontset=notexist' should have failed")
|
||||
catch
|
||||
call assert_exception('E598')
|
||||
endtry
|
||||
" Set it to an invalid value brutally for preparation.
|
||||
let &guifontset = '-*-notexist-*'
|
||||
|
||||
" Case 2-1: Automatic selection
|
||||
set guifontwide=
|
||||
exec 'set guifont=' . l:nfont
|
||||
call assert_equal(l:wfont, &guifontwide)
|
||||
|
||||
" Case 2-2: Manual selection
|
||||
exec 'set guifontwide=' . l:wfont
|
||||
exec 'set guifont=' . l:nfont
|
||||
call assert_equal(l:wfont, &guifontwide)
|
||||
|
||||
let &guifontwide = l:guifontwide_saved
|
||||
let &guifontset = l:guifontset_saved
|
||||
let &guifont = l:guifont_saved
|
||||
let &encoding = l:encoding_saved
|
||||
else
|
||||
let skipped = 2
|
||||
endif
|
||||
else
|
||||
let skipped = 1
|
||||
endif
|
||||
|
||||
if skipped == 1
|
||||
throw "Skipped: Test not implemented yet for this GUI"
|
||||
elseif skipped == 2
|
||||
throw "Skipped: Not supported by this GUI"
|
||||
elseif skipped == 3
|
||||
throw "Skipped: Test not supported by the environment"
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_getwinpos()
|
||||
call assert_match('Window position: X \d\+, Y \d\+', execute('winpos'))
|
||||
call assert_true(getwinposx() >= 0)
|
||||
call assert_true(getwinposy() >= 0)
|
||||
endfunc
|
||||
|
||||
func Test_shell_command()
|
||||
new
|
||||
r !echo hello
|
||||
call assert_equal('hello', substitute(getline(2), '\W', '', 'g'))
|
||||
bwipe!
|
||||
call assert_true(1, match(execute('winpos'), 'Window position: X \d\+, Y \d\+') >= 0)
|
||||
endfunc
|
||||
|
||||
func Test_windowid_variable()
|
||||
if s:x11_based_gui || has('win32')
|
||||
call assert_true(v:windowid > 0)
|
||||
else
|
||||
call assert_equal(0, v:windowid)
|
||||
endif
|
||||
endfunc
|
||||
|
||||
@@ -144,6 +144,11 @@ func Test_json_decode()
|
||||
call assert_equal(type(v:none), type(json_decode('')))
|
||||
call assert_equal("", json_decode('""'))
|
||||
|
||||
" empty key is OK
|
||||
call assert_equal({'': 'ok'}, json_decode('{"": "ok"}'))
|
||||
" but not twice
|
||||
call assert_fails("call json_decode('{\"\": \"ok\", \"\": \"bad\"}')", 'E938:')
|
||||
|
||||
call assert_equal({'n': 1}, json_decode('{"n":1,}'))
|
||||
call assert_fails("call json_decode(\"{'n':'1',}\")", 'E474:')
|
||||
call assert_fails("call json_decode(\"'n'\")", 'E474:')
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
Test for linebreak and list option (non-utf8)
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:if !exists("+linebreak") || !has("conceal") | e! test.ok | w! test.out | qa! | endif
|
||||
:10new|:vsp|:vert resize 20
|
||||
:put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \"
|
||||
:norm! zt
|
||||
:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
|
||||
:fu! ScreenChar(width)
|
||||
: let c=''
|
||||
: for j in range(1,4)
|
||||
: for i in range(1,a:width)
|
||||
: let c.=nr2char(screenchar(j, i))
|
||||
: endfor
|
||||
: let c.="\n"
|
||||
: endfor
|
||||
: return c
|
||||
:endfu
|
||||
:fu! DoRecordScreen()
|
||||
: wincmd l
|
||||
: $put =printf(\"\n%s\", g:test)
|
||||
: $put =g:line
|
||||
: wincmd p
|
||||
:endfu
|
||||
:"
|
||||
:let g:test="Test 1: set linebreak"
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0))
|
||||
:call DoRecordScreen()
|
||||
:"
|
||||
:let g:test="Test 2: set linebreak + set list"
|
||||
:set linebreak list listchars=
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0))
|
||||
:call DoRecordScreen()
|
||||
:"
|
||||
:let g:test ="Test 3: set linebreak nolist"
|
||||
:set nolist linebreak
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0))
|
||||
:call DoRecordScreen()
|
||||
:"
|
||||
:let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"
|
||||
:set nolist linebreak ts=8
|
||||
:let line="1\t".repeat('a', winwidth(0)-2)
|
||||
:$put =line
|
||||
:$
|
||||
:norm! zt
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0))
|
||||
:call DoRecordScreen()
|
||||
:let line="_S_\t bla"
|
||||
:$put =line
|
||||
:$
|
||||
:norm! zt
|
||||
:"
|
||||
:let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"
|
||||
:set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab
|
||||
:syn match ConcealVar contained /_/ conceal
|
||||
:syn match All /.*/ contains=ConcealVar
|
||||
:let line=ScreenChar(winwidth(0))
|
||||
:call DoRecordScreen()
|
||||
:set cpo&vim linebreak
|
||||
:"
|
||||
:let g:test ="Test 6: set linebreak with visual block mode"
|
||||
:let line="REMOVE: this not"
|
||||
:$put =g:test
|
||||
:$put =line
|
||||
:let line="REMOVE: aaaaaaaaaaaaa"
|
||||
:$put =line
|
||||
:1/^REMOVE:
|
||||
0jf x:$put
|
||||
:set cpo&vim linebreak
|
||||
:"
|
||||
:let g:test ="Test 7: set linebreak with visual block mode and v_b_A"
|
||||
:$put =g:test
|
||||
Golong line: 40afoobar aTARGET at end
|
||||
:exe "norm! $3B\<C-v>eAx\<Esc>"
|
||||
:set cpo&vim linebreak sbr=
|
||||
:"
|
||||
:let g:test ="Test 8: set linebreak with visual char mode and changing block"
|
||||
:$put =g:test
|
||||
Go1111-1111-1111-11-1111-1111-11110f-lv3lc2222bgj.
|
||||
:"
|
||||
:let g:test ="Test 9: using redo after block visual mode"
|
||||
:$put =g:test
|
||||
Go
|
||||
aaa
|
||||
aaa
|
||||
a2k2j~e.
|
||||
:"
|
||||
:let g:test ="Test 10: using normal commands after block-visual"
|
||||
:$put =g:test
|
||||
:set linebreak
|
||||
Go
|
||||
abcd{ef
|
||||
ghijklm
|
||||
no}pqrs2k0f{c%
|
||||
:"
|
||||
:let g:test ="Test 11: using block replace mode after wrapping"
|
||||
:$put =g:test
|
||||
:set linebreak wrap
|
||||
Go150aayypk147|jr0
|
||||
:"
|
||||
:let g:test ="Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$"
|
||||
:set list listchars=space:_,trail:-,tab:>-,eol:$
|
||||
:$put =g:test
|
||||
:let line="a aaaaaaaaaaaaaaaaaaaaaa\ta "
|
||||
:$put =line
|
||||
:$
|
||||
:norm! zt
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0))
|
||||
:call DoRecordScreen()
|
||||
:%w! test.out
|
||||
:qa!
|
||||
ENDTEST
|
||||
dummy text
|
||||
@@ -1,62 +0,0 @@
|
||||
|
||||
abcdef hijklmn pqrstuvwxyz_1060ABCDEFGHIJKLMNOP
|
||||
|
||||
Test 1: set linebreak
|
||||
abcdef
|
||||
+hijklmn
|
||||
+pqrstuvwxyz_1060ABC
|
||||
+DEFGHIJKLMNOP
|
||||
|
||||
Test 2: set linebreak + set list
|
||||
^Iabcdef hijklmn^I
|
||||
+pqrstuvwxyz_1060ABC
|
||||
+DEFGHIJKLMNOP
|
||||
|
||||
|
||||
Test 3: set linebreak nolist
|
||||
abcdef
|
||||
+hijklmn
|
||||
+pqrstuvwxyz_1060ABC
|
||||
+DEFGHIJKLMNOP
|
||||
1 aaaaaaaaaaaaaaaaaa
|
||||
|
||||
Test 4: set linebreak with tab and 1 line as long as screen: should break!
|
||||
1
|
||||
+aaaaaaaaaaaaaaaaaa
|
||||
~
|
||||
~
|
||||
_S_ bla
|
||||
|
||||
Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)
|
||||
Sabbbbbb bla
|
||||
~
|
||||
~
|
||||
~
|
||||
Test 6: set linebreak with visual block mode
|
||||
this not
|
||||
aaaaaaaaaaaaa
|
||||
REMOVE:
|
||||
REMOVE:
|
||||
Test 7: set linebreak with visual block mode and v_b_A
|
||||
long line: foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar TARGETx at end
|
||||
Test 8: set linebreak with visual char mode and changing block
|
||||
1111-2222-1111-11-1111-2222-1111
|
||||
Test 9: using redo after block visual mode
|
||||
|
||||
AaA
|
||||
AaA
|
||||
A
|
||||
Test 10: using normal commands after block-visual
|
||||
|
||||
abcdpqrs
|
||||
Test 11: using block replace mode after wrapping
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaa
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaa
|
||||
Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$
|
||||
a aaaaaaaaaaaaaaaaaaaaaa a
|
||||
|
||||
Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$
|
||||
a_
|
||||
aaaaaaaaaaaaaaaaaaaa
|
||||
aa>-----a-$
|
||||
~
|
||||
@@ -0,0 +1,219 @@
|
||||
" Test for linebreak and list option (non-utf8)
|
||||
|
||||
set encoding=latin1
|
||||
scriptencoding latin1
|
||||
|
||||
if !exists("+linebreak") || !has("conceal")
|
||||
finish
|
||||
endif
|
||||
|
||||
source view_util.vim
|
||||
|
||||
function s:screen_lines(lnum, width) abort
|
||||
return ScreenLines(a:lnum, a:width)
|
||||
endfunction
|
||||
|
||||
function! s:compare_lines(expect, actual)
|
||||
call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
|
||||
endfunction
|
||||
|
||||
function s:test_windows(...)
|
||||
call NewWindow(10, 20)
|
||||
setl ts=8 sw=4 sts=4 linebreak sbr= wrap
|
||||
exe get(a:000, 0, '')
|
||||
endfunction
|
||||
|
||||
function s:close_windows(...)
|
||||
call CloseWindow()
|
||||
exe get(a:000, 0, '')
|
||||
endfunction
|
||||
|
||||
func Test_set_linebreak()
|
||||
call s:test_windows('setl ts=4 sbr=+')
|
||||
call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ " abcdef ",
|
||||
\ "+hijklmn ",
|
||||
\ "+pqrstuvwxyz_1060ABC",
|
||||
\ "+DEFGHIJKLMNOP ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_linebreak_with_list()
|
||||
call s:test_windows('setl ts=4 sbr=+ list listchars=')
|
||||
call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ "^Iabcdef hijklmn^I ",
|
||||
\ "+pqrstuvwxyz_1060ABC",
|
||||
\ "+DEFGHIJKLMNOP ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_linebreak_with_nolist()
|
||||
call s:test_windows('setl ts=4 sbr=+ nolist')
|
||||
call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ " abcdef ",
|
||||
\ "+hijklmn ",
|
||||
\ "+pqrstuvwxyz_1060ABC",
|
||||
\ "+DEFGHIJKLMNOP ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_should_break()
|
||||
call s:test_windows('setl sbr=+ nolist')
|
||||
call setline(1, "1\t" . repeat('a', winwidth(0)-2))
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ "1 ",
|
||||
\ "+aaaaaaaaaaaaaaaaaa ",
|
||||
\ "~ ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_linebreak_with_conceal()
|
||||
call s:test_windows('setl cpo&vim sbr=+ list conceallevel=2 concealcursor=nv listchars=tab:ab')
|
||||
call setline(1, "_S_\t bla")
|
||||
syn match ConcealVar contained /_/ conceal
|
||||
syn match All /.*/ contains=ConcealVar
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ "Sabbbbbb bla ",
|
||||
\ "~ ",
|
||||
\ "~ ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_virtual_block()
|
||||
call s:test_windows('setl sbr=+')
|
||||
call setline(1, [
|
||||
\ "REMOVE: this not",
|
||||
\ "REMOVE: aaaaaaaaaaaaa",
|
||||
\ ])
|
||||
exe "norm! 1/^REMOVE:"
|
||||
exe "norm! 0\<C-V>jf x"
|
||||
$put
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ "this not ",
|
||||
\ "aaaaaaaaaaaaa ",
|
||||
\ "REMOVE: ",
|
||||
\ "REMOVE: ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_virtual_block_and_vbA()
|
||||
call s:test_windows()
|
||||
call setline(1, "long line: " . repeat("foobar ", 40) . "TARGET at end")
|
||||
exe "norm! $3B\<C-v>eAx\<Esc>"
|
||||
let lines = s:screen_lines([1, 10], winwidth(0))
|
||||
let expect = [
|
||||
\ "foobar foobar ",
|
||||
\ "foobar foobar ",
|
||||
\ "foobar foobar ",
|
||||
\ "foobar foobar ",
|
||||
\ "foobar foobar ",
|
||||
\ "foobar foobar ",
|
||||
\ "foobar foobar ",
|
||||
\ "foobar foobar ",
|
||||
\ "foobar foobar ",
|
||||
\ "foobar TARGETx at ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_virtual_char_and_block()
|
||||
call s:test_windows()
|
||||
call setline(1, "1111-1111-1111-11-1111-1111-1111")
|
||||
exe "norm! 0f-lv3lc2222\<Esc>bgj."
|
||||
let lines = s:screen_lines([1, 2], winwidth(0))
|
||||
let expect = [
|
||||
\ "1111-2222-1111-11- ",
|
||||
\ "1111-2222-1111 ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_undo_after_block_visual()
|
||||
call s:test_windows()
|
||||
call setline(1, ["aaa", "aaa", "a"])
|
||||
exe "norm! gg\<C-V>2j~e."
|
||||
let lines = s:screen_lines([1, 3], winwidth(0))
|
||||
let expect = [
|
||||
\ "AaA ",
|
||||
\ "AaA ",
|
||||
\ "A ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_norm_after_block_visual()
|
||||
call s:test_windows()
|
||||
call setline(1, ["abcd{ef", "ghijklm", "no}pgrs"])
|
||||
exe "norm! ggf{\<C-V>\<C-V>c%"
|
||||
let lines = s:screen_lines([1, 3], winwidth(0))
|
||||
let expect = [
|
||||
\ "abcdpgrs ",
|
||||
\ "~ ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_block_replace_after_wrapping()
|
||||
call s:test_windows()
|
||||
call setline(1, repeat("a", 150))
|
||||
exe "norm! 0yypk147|\<C-V>jr0"
|
||||
call assert_equal(repeat("a", 146) . "0aaa", getline(1))
|
||||
call assert_equal(repeat("a", 146) . "0aaa", getline(2))
|
||||
let lines = s:screen_lines([1, 10], winwidth(0))
|
||||
let expect = [
|
||||
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||
\ "aaaaaa0aaa ",
|
||||
\ "@ ",
|
||||
\ "@ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_list_with_listchars()
|
||||
call s:test_windows('setl list listchars=space:_,trail:-,tab:>-,eol:$')
|
||||
call setline(1, "a aaaaaaaaaaaaaaaaaaaaaa\ta ")
|
||||
let lines = s:screen_lines([1, 3], winwidth(0))
|
||||
let expect = [
|
||||
\ "a_ ",
|
||||
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||
\ "aa>-----a-$ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
@@ -1,134 +0,0 @@
|
||||
Test for linebreak and list option in utf-8 mode
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:if !exists("+linebreak") || !has("conceal") || !has("signs") | e! test.ok | w! test.out | qa! | endif
|
||||
:so mbyte.vim
|
||||
:set encoding=utf8
|
||||
:if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif
|
||||
:10new|:vsp|:vert resize 20
|
||||
:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \"
|
||||
:norm! zt
|
||||
:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
|
||||
:fu! ScreenChar(width, lines)
|
||||
: let c=''
|
||||
: for j in range(1,a:lines)
|
||||
: for i in range(1,a:width)
|
||||
: let c.=nr2char(screenchar(j, i))
|
||||
: endfor
|
||||
: let c.="\n"
|
||||
: endfor
|
||||
: return c
|
||||
:endfu
|
||||
:fu! DoRecordScreen()
|
||||
: wincmd l
|
||||
: $put =printf(\"\n%s\", g:test)
|
||||
: $put =g:line
|
||||
: wincmd p
|
||||
:endfu
|
||||
:"
|
||||
:let g:test ="Test 1: set linebreak + set list + fancy listchars"
|
||||
:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0),4)
|
||||
:call DoRecordScreen()
|
||||
:"
|
||||
:let g:test ="Test 2: set nolinebreak list"
|
||||
:set list nolinebreak
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0),4)
|
||||
:call DoRecordScreen()
|
||||
:"
|
||||
:let g:test ="Test 3: set linebreak nolist"
|
||||
:$put =\"\t*mask = nil;\"
|
||||
:$
|
||||
:norm! zt
|
||||
:set nolist linebreak
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0),4)
|
||||
:call DoRecordScreen()
|
||||
:"
|
||||
:let g:test ="Test 4: set linebreak list listchars and concealing"
|
||||
:let c_defines=['#define ABCDE 1','#define ABCDEF 1','#define ABCDEFG 1','#define ABCDEFGH 1', '#define MSG_MODE_FILE 1','#define MSG_MODE_CONSOLE 2','#define MSG_MODE_FILE_AND_CONSOLE 3','#define MSG_MODE_FILE_THEN_CONSOLE 4']
|
||||
:call append('$', c_defines)
|
||||
:vert resize 40
|
||||
:$-7
|
||||
:norm! zt
|
||||
:set list linebreak listchars=tab:>- cole=1
|
||||
:syn match Conceal conceal cchar=>'AB\|MSG_MODE'
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0),7)
|
||||
:call DoRecordScreen()
|
||||
:"
|
||||
:let g:test ="Test 5: set linebreak list listchars and concealing part2"
|
||||
:let c_defines=['bbeeeeee ; some text']
|
||||
:call append('$', c_defines)
|
||||
:$
|
||||
:norm! zt
|
||||
:set nowrap ts=2 list linebreak listchars=tab:>- cole=2 concealcursor=n
|
||||
:syn clear
|
||||
:syn match meaning /;\s*\zs.*/
|
||||
:syn match hasword /^\x\{8}/ contains=word
|
||||
:syn match word /\<\x\{8}\>/ contains=beginword,endword contained
|
||||
:syn match beginword /\<\x\x/ contained conceal
|
||||
:syn match endword /\x\{6}\>/ contained
|
||||
:hi meaning guibg=blue
|
||||
:hi beginword guibg=green
|
||||
:hi endword guibg=red
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0),1)
|
||||
:call DoRecordScreen()
|
||||
:"
|
||||
:let g:test ="Test 6: Screenattributes for comment"
|
||||
:$put =g:test
|
||||
:call append('$', ' /* and some more */')
|
||||
:exe "set ft=c ts=7 linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
|
||||
:syntax on
|
||||
:hi SpecialKey term=underline ctermfg=red guifg=red
|
||||
:let attr=[]
|
||||
:nnoremap <expr> GG ":let attr += ['".screenattr(screenrow(),screencol())."']\n"
|
||||
:$
|
||||
:norm! zt0
|
||||
GGlGGlGGlGGlGGlGGlGGlGGlGGlGGl
|
||||
:call append('$', ['ScreenAttributes for test6:'])
|
||||
:if attr[0] != attr[1] && attr[1] != attr[3] && attr[3] != attr[5]
|
||||
: call append('$', "Attribut 0 and 1 and 3 and 5 are different!")
|
||||
:else
|
||||
: call append('$', "Not all attributes are different")
|
||||
:endif
|
||||
:set cpo&vim linebreak selection=exclusive
|
||||
:"
|
||||
:let g:test ="Test 8: set linebreak with visual block mode and v_b_A and selection=exclusive and multibyte char"
|
||||
:$put =g:test
|
||||
Golong line: 40afoobar aTARGETÃ' at end
|
||||
:exe "norm! $3B\<C-v>eAx\<Esc>"
|
||||
:"
|
||||
:let g:test ="Test 9: a multibyte sign and colorcolumn"
|
||||
:let attr=[]
|
||||
:let attr2=[]
|
||||
:$put =''
|
||||
:$put ='a b c'
|
||||
:$put ='a b c'
|
||||
:set list nolinebreak cc=3
|
||||
:sign define foo text=uff0b
|
||||
:sign place 1 name=foo line=50 buffer=2
|
||||
:norm! 2kztj
|
||||
:let line1=line('.')
|
||||
0GGlGGlGGlGGl
|
||||
:let line2=line('.')
|
||||
:let attr2=attr
|
||||
:let attr=[]
|
||||
0GGlGGlGGlGGl
|
||||
:redraw!
|
||||
:let line=ScreenChar(winwidth(0),3)
|
||||
:call DoRecordScreen()
|
||||
:" expected: attr[2] is different because of colorcolumn
|
||||
:if attr[0] != attr2[0] || attr[1] != attr2[1] || attr[2] != attr2[2]
|
||||
: call append('$', "Screen attributes are different!")
|
||||
:else
|
||||
: call append('$', "Screen attributes are the same!")
|
||||
:endif
|
||||
:%w! test.out
|
||||
:qa!
|
||||
ENDTEST
|
||||
dummy text
|
||||
@@ -1,57 +0,0 @@
|
||||
|
||||
abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP
|
||||
|
||||
Test 1: set linebreak + set list + fancy listchars
|
||||
▕———abcdef
|
||||
+hijklmn▕———
|
||||
+pqrstuvwxyz␣1060ABC
|
||||
+DEFGHIJKLMNOPˑ¶
|
||||
|
||||
Test 2: set nolinebreak list
|
||||
▕———abcdef hijklmn▕—
|
||||
+pqrstuvwxyz␣1060ABC
|
||||
+DEFGHIJKLMNOPˑ¶
|
||||
¶
|
||||
*mask = nil;
|
||||
|
||||
Test 3: set linebreak nolist
|
||||
*mask = nil;
|
||||
~
|
||||
~
|
||||
~
|
||||
#define ABCDE 1
|
||||
#define ABCDEF 1
|
||||
#define ABCDEFG 1
|
||||
#define ABCDEFGH 1
|
||||
#define MSG_MODE_FILE 1
|
||||
#define MSG_MODE_CONSOLE 2
|
||||
#define MSG_MODE_FILE_AND_CONSOLE 3
|
||||
#define MSG_MODE_FILE_THEN_CONSOLE 4
|
||||
|
||||
Test 4: set linebreak list listchars and concealing
|
||||
#define ABCDE>-->---1
|
||||
#define >CDEF>-->---1
|
||||
#define >CDEFG>->---1
|
||||
#define >CDEFGH>----1
|
||||
#define >_FILE>--------->--->---1
|
||||
#define >_CONSOLE>---------->---2
|
||||
#define >_FILE_AND_CONSOLE>---------3
|
||||
bbeeeeee ; some text
|
||||
|
||||
Test 5: set linebreak list listchars and concealing part2
|
||||
eeeeee>--->-;>some text
|
||||
Test 6: Screenattributes for comment
|
||||
/* and some more */
|
||||
ScreenAttributes for test6:
|
||||
Attribut 0 and 1 and 3 and 5 are different!
|
||||
Test 8: set linebreak with visual block mode and v_b_A and selection=exclusive and multibyte char
|
||||
long line: foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar TARGETÃx' at end
|
||||
|
||||
a b c
|
||||
a b c
|
||||
|
||||
Test 9: a multibyte sign and colorcolumn
|
||||
¶
|
||||
+a b c¶
|
||||
a b c¶
|
||||
Screen attributes are the same!
|
||||
@@ -0,0 +1,195 @@
|
||||
" Test for linebreak and list option in utf-8 mode
|
||||
|
||||
set encoding=utf-8
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists("+linebreak") || !has("conceal") || !has("signs")
|
||||
finish
|
||||
endif
|
||||
|
||||
source view_util.vim
|
||||
|
||||
function s:screen_lines(lnum, width) abort
|
||||
return ScreenLines(a:lnum, a:width)
|
||||
endfunction
|
||||
|
||||
function! s:compare_lines(expect, actual)
|
||||
call assert_equal(a:expect, a:actual)
|
||||
endfunction
|
||||
|
||||
function s:screen_attr(lnum, chars, ...) abort
|
||||
let line = getline(a:lnum)
|
||||
let attr = []
|
||||
let prefix = get(a:000, 0, 0)
|
||||
for i in range(a:chars[0], a:chars[1])
|
||||
let scol = strdisplaywidth(strcharpart(line, 0, i-1)) + 1
|
||||
let attr += [screenattr(a:lnum, scol + prefix)]
|
||||
endfor
|
||||
return attr
|
||||
endfunction
|
||||
|
||||
function s:test_windows(...)
|
||||
call NewWindow(10, 20)
|
||||
setl ts=4 sw=4 sts=4 linebreak sbr=+ wrap
|
||||
exe get(a:000, 0, '')
|
||||
endfunction
|
||||
|
||||
function s:close_windows(...)
|
||||
call CloseWindow()
|
||||
exe get(a:000, 0, '')
|
||||
endfunction
|
||||
|
||||
func Test_linebreak_with_fancy_listchars()
|
||||
call s:test_windows("setl list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6")
|
||||
call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP ")
|
||||
redraw!
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ "▕———abcdef ",
|
||||
\ "+hijklmn▕——— ",
|
||||
\ "+pqrstuvwxyz␣1060ABC",
|
||||
\ "+DEFGHIJKLMNOPˑ¶ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_nolinebreak_with_list()
|
||||
call s:test_windows("setl nolinebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6")
|
||||
call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP ")
|
||||
redraw!
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ "▕———abcdef hijklmn▕—",
|
||||
\ "+pqrstuvwxyz␣1060ABC",
|
||||
\ "+DEFGHIJKLMNOPˑ¶ ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_linebreak_with_nolist()
|
||||
call s:test_windows('setl nolist')
|
||||
call setline(1, "\t*mask = nil;")
|
||||
redraw!
|
||||
let lines = s:screen_lines([1, 4], winwidth(0))
|
||||
let expect = [
|
||||
\ " *mask = nil; ",
|
||||
\ "~ ",
|
||||
\ "~ ",
|
||||
\ "~ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_list_and_concealing1()
|
||||
call s:test_windows('setl list listchars=tab:>- cole=1')
|
||||
call setline(1, [
|
||||
\ "#define ABCDE\t\t1",
|
||||
\ "#define ABCDEF\t\t1",
|
||||
\ "#define ABCDEFG\t\t1",
|
||||
\ "#define ABCDEFGH\t1",
|
||||
\ "#define MSG_MODE_FILE\t\t\t1",
|
||||
\ "#define MSG_MODE_CONSOLE\t\t2",
|
||||
\ "#define MSG_MODE_FILE_AND_CONSOLE\t3",
|
||||
\ "#define MSG_MODE_FILE_THEN_CONSOLE\t4",
|
||||
\ ])
|
||||
vert resize 40
|
||||
syn match Conceal conceal cchar=>'AB\|MSG_MODE'
|
||||
redraw!
|
||||
let lines = s:screen_lines([1, 7], winwidth(0))
|
||||
let expect = [
|
||||
\ "#define ABCDE>-->---1 ",
|
||||
\ "#define >CDEF>-->---1 ",
|
||||
\ "#define >CDEFG>->---1 ",
|
||||
\ "#define >CDEFGH>----1 ",
|
||||
\ "#define >_FILE>--------->--->---1 ",
|
||||
\ "#define >_CONSOLE>---------->---2 ",
|
||||
\ "#define >_FILE_AND_CONSOLE>---------3 ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_list_and_concealing2()
|
||||
call s:test_windows('setl nowrap ts=2 list listchars=tab:>- cole=2 concealcursor=n')
|
||||
call setline(1, "bbeeeeee\t\t;\tsome text")
|
||||
vert resize 40
|
||||
syn clear
|
||||
syn match meaning /;\s*\zs.*/
|
||||
syn match hasword /^\x\{8}/ contains=word
|
||||
syn match word /\<\x\{8}\>/ contains=beginword,endword contained
|
||||
syn match beginword /\<\x\x/ contained conceal
|
||||
syn match endword /\x\{6}\>/ contained
|
||||
hi meaning guibg=blue
|
||||
hi beginword guibg=green
|
||||
hi endword guibg=red
|
||||
redraw!
|
||||
let lines = s:screen_lines([1, 1], winwidth(0))
|
||||
let expect = [
|
||||
\ "eeeeee>--->-;>some text ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_screenattr_for_comment()
|
||||
call s:test_windows("setl ft=c ts=7 list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6")
|
||||
call setline(1, " /*\t\t and some more */")
|
||||
norm! gg0
|
||||
syntax on
|
||||
hi SpecialKey term=underline ctermfg=red guifg=red
|
||||
redraw!
|
||||
let line = getline(1)
|
||||
let attr = s:screen_attr(1, [1, 6])
|
||||
call assert_notequal(attr[0], attr[1])
|
||||
call assert_notequal(attr[1], attr[3])
|
||||
call assert_notequal(attr[3], attr[5])
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_visual_block_and_selection_exclusive()
|
||||
call s:test_windows('setl selection=exclusive')
|
||||
call setline(1, "long line: " . repeat("foobar ", 40) . "TARGETÃ' at end")
|
||||
exe "norm! $3B\<C-v>eAx\<Esc>"
|
||||
let lines = s:screen_lines([1, 10], winwidth(0))
|
||||
let expect = [
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar foobar ",
|
||||
\ "+foobar TARGETÃx' ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
|
||||
func Test_multibyte_sign_and_colorcolumn()
|
||||
call s:test_windows("setl nolinebreak cc=3 list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6")
|
||||
call setline(1, ["", "a b c", "a b c"])
|
||||
exe "sign define foo text=\uff0b"
|
||||
exe "sign place 1 name=foo line=2 buffer=" . bufnr('%')
|
||||
redraw!
|
||||
norm! ggj0
|
||||
let signwidth = strdisplaywidth("\uff0b")
|
||||
let attr1 = s:screen_attr(2, [1, 3], signwidth)
|
||||
let attr2 = s:screen_attr(3, [1, 3], signwidth)
|
||||
call assert_equal(attr1[0], attr2[0])
|
||||
call assert_equal(attr1[1], attr2[1])
|
||||
call assert_equal(attr1[2], attr2[2])
|
||||
let lines = s:screen_lines([1, 3], winwidth(0))
|
||||
let expect = [
|
||||
\ " ¶ ",
|
||||
\ "+a b c¶ ",
|
||||
\ " a b c¶ ",
|
||||
\ ]
|
||||
call s:compare_lines(expect, lines)
|
||||
call s:close_windows()
|
||||
endfunc
|
||||
@@ -13,6 +13,12 @@ function! Test_whichwrap()
|
||||
set whichwrap+=h,l
|
||||
call assert_equal('b,s,h,l', &whichwrap)
|
||||
|
||||
set whichwrap=h,h
|
||||
call assert_equal('h', &whichwrap)
|
||||
|
||||
set whichwrap=h,h,h
|
||||
call assert_equal('h', &whichwrap)
|
||||
|
||||
set whichwrap&
|
||||
endfunction
|
||||
|
||||
@@ -128,4 +134,95 @@ endfunc
|
||||
|
||||
func Test_thesaurus()
|
||||
call Check_dir_option('thesaurus')
|
||||
endfun
|
||||
|
||||
func Test_set_completion()
|
||||
call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:)
|
||||
|
||||
" Expand boolan options. When doing :set no<Tab>
|
||||
" vim displays the options names without "no" but completion uses "no...".
|
||||
call feedkeys(":set nodi\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set nodiff digraph', @:)
|
||||
|
||||
call feedkeys(":set invdi\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set invdiff digraph', @:)
|
||||
|
||||
" Expand abbreviation of options.
|
||||
call feedkeys(":set ts\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set tabstop thesaurus ttyscroll', @:)
|
||||
|
||||
" Expand current value
|
||||
call feedkeys(":set fileencodings=\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set fileencodings=ucs-bom,utf-8,default,latin1', @:)
|
||||
|
||||
call feedkeys(":set fileencodings:\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set fileencodings:ucs-bom,utf-8,default,latin1', @:)
|
||||
|
||||
" Expand key codes.
|
||||
call feedkeys(":set <H\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set <Help> <Home>', @:)
|
||||
|
||||
" Expand terminal options.
|
||||
call feedkeys(":set t_A\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set t_AB t_AF t_AL', @:)
|
||||
|
||||
" Expand directories.
|
||||
call feedkeys(":set cdpath=./\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_match(' ./samples/ ', @:)
|
||||
call assert_notmatch(' ./small.vim ', @:)
|
||||
|
||||
" Expand files and directories.
|
||||
call feedkeys(":set tags=./\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_match(' ./samples/.* ./small.vim', @:)
|
||||
|
||||
call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:)
|
||||
endfunc
|
||||
|
||||
func Test_set_errors()
|
||||
call assert_fails('set scroll=-1', 'E49:')
|
||||
call assert_fails('set backupcopy=', 'E474:')
|
||||
call assert_fails('set regexpengine=3', 'E474:')
|
||||
call assert_fails('set history=10001', 'E474:')
|
||||
call assert_fails('set numberwidth=11', 'E474:')
|
||||
call assert_fails('set colorcolumn=-a')
|
||||
call assert_fails('set colorcolumn=a')
|
||||
call assert_fails('set colorcolumn=1,')
|
||||
call assert_fails('set cmdheight=-1', 'E487:')
|
||||
call assert_fails('set cmdwinheight=-1', 'E487:')
|
||||
if has('conceal')
|
||||
call assert_fails('set conceallevel=-1', 'E487:')
|
||||
call assert_fails('set conceallevel=4', 'E474:')
|
||||
endif
|
||||
call assert_fails('set helpheight=-1', 'E487:')
|
||||
call assert_fails('set history=-1', 'E487:')
|
||||
call assert_fails('set report=-1', 'E487:')
|
||||
call assert_fails('set shiftwidth=-1', 'E487:')
|
||||
call assert_fails('set sidescroll=-1', 'E487:')
|
||||
call assert_fails('set tabstop=-1', 'E487:')
|
||||
call assert_fails('set textwidth=-1', 'E487:')
|
||||
call assert_fails('set timeoutlen=-1', 'E487:')
|
||||
call assert_fails('set updatecount=-1', 'E487:')
|
||||
call assert_fails('set updatetime=-1', 'E487:')
|
||||
call assert_fails('set winheight=-1', 'E487:')
|
||||
call assert_fails('set tabstop!', 'E488:')
|
||||
call assert_fails('set xxx', 'E518:')
|
||||
call assert_fails('set beautify?', 'E519:')
|
||||
call assert_fails('set undolevels=x', 'E521:')
|
||||
call assert_fails('set tabstop=', 'E521:')
|
||||
call assert_fails('set comments=-', 'E524:')
|
||||
call assert_fails('set comments=a', 'E525:')
|
||||
call assert_fails('set foldmarker=x', 'E536:')
|
||||
call assert_fails('set commentstring=x', 'E537:')
|
||||
call assert_fails('set complete=x', 'E539:')
|
||||
call assert_fails('set statusline=%{', 'E540:')
|
||||
call assert_fails('set statusline=' . repeat("%p", 81), 'E541:')
|
||||
call assert_fails('set statusline=%(', 'E542:')
|
||||
call assert_fails('set guicursor=x', 'E545:')
|
||||
call assert_fails('set backupext=~ patchmode=~', 'E589:')
|
||||
call assert_fails('set winminheight=10 winheight=9', 'E591:')
|
||||
call assert_fails('set winminwidth=10 winwidth=9', 'E592:')
|
||||
call assert_fails("set showbreak=\x01", 'E595:')
|
||||
call assert_fails('set t_foo=', 'E846:')
|
||||
endfunc
|
||||
|
||||
@@ -67,6 +67,40 @@ func Test_packadd_noload()
|
||||
call assert_equal(new_rtp, &rtp)
|
||||
endfunc
|
||||
|
||||
func Test_packadd_symlink_dir()
|
||||
if !has('unix')
|
||||
return
|
||||
endif
|
||||
let top2_dir = s:topdir . '/Xdir2'
|
||||
let real_dir = s:topdir . '/Xsym'
|
||||
exec "silent !ln -s" real_dir top2_dir
|
||||
let &rtp = top2_dir . ',' . top2_dir . '/after'
|
||||
let &packpath = &rtp
|
||||
|
||||
let s:plugdir = top2_dir . '/pack/mine/opt/mytest'
|
||||
call mkdir(s:plugdir . '/plugin', 'p')
|
||||
|
||||
exe 'split ' . s:plugdir . '/plugin/test.vim'
|
||||
call setline(1, 'let g:plugin_works = 44')
|
||||
wq
|
||||
let g:plugin_works = 0
|
||||
|
||||
packadd mytest
|
||||
|
||||
" Must have been inserted in the middle, not at the end
|
||||
call assert_true(&rtp =~ '/pack/mine/opt/mytest,')
|
||||
call assert_equal(44, g:plugin_works)
|
||||
|
||||
" No change when doing it again.
|
||||
let rtp_before = &rtp
|
||||
packadd mytest
|
||||
call assert_equal(rtp_before, &rtp)
|
||||
|
||||
set rtp&
|
||||
let rtp = &rtp
|
||||
exec "silent !rm" top2_dir
|
||||
endfunc
|
||||
|
||||
" Check command-line completion for 'packadd'
|
||||
func Test_packadd_completion()
|
||||
let optdir1 = &packpath . '/pack/mine/opt'
|
||||
|
||||
@@ -70,3 +70,30 @@ func Test_paste_cmdline()
|
||||
call feedkeys(":a\<Esc>[200~foo\<CR>bar\<Esc>[201~b\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal("\"afoo\<CR>barb", getreg(':'))
|
||||
endfunc
|
||||
|
||||
func Test_paste_visual_mode()
|
||||
new
|
||||
call setline(1, 'here are some words')
|
||||
call feedkeys("0fsve\<Esc>[200~more\<Esc>[201~", 'xt')
|
||||
call assert_equal('here are more words', getline(1))
|
||||
call assert_equal('some', getreg('-'))
|
||||
|
||||
" include last char in the line
|
||||
call feedkeys("0fwve\<Esc>[200~noises\<Esc>[201~", 'xt')
|
||||
call assert_equal('here are more noises', getline(1))
|
||||
call assert_equal('words', getreg('-'))
|
||||
|
||||
" exclude last char in the line
|
||||
call setline(1, 'some words!')
|
||||
call feedkeys("0fwve\<Esc>[200~noises\<Esc>[201~", 'xt')
|
||||
call assert_equal('some noises!', getline(1))
|
||||
call assert_equal('words', getreg('-'))
|
||||
|
||||
" multi-line selection
|
||||
call setline(1, ['some words', 'and more'])
|
||||
call feedkeys("0fwvj0fd\<Esc>[200~letters\<Esc>[201~", 'xt')
|
||||
call assert_equal('some letters more', getline(1))
|
||||
call assert_equal("words\nand", getreg('1'))
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
@@ -511,4 +511,24 @@ func Test_completion_clear_candidate_list()
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
func Test_completion_respect_bs_option()
|
||||
new
|
||||
let li = ["aaa", "aaa12345", "aaaabcdef", "aaaABC"]
|
||||
|
||||
set bs=indent,eol
|
||||
call setline(1, li)
|
||||
1
|
||||
call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
|
||||
call assert_equal('aaa', getline(1))
|
||||
|
||||
%d
|
||||
set bs=indent,eol,start
|
||||
call setline(1, li)
|
||||
1
|
||||
call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
|
||||
call assert_equal('', getline(1))
|
||||
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
" Functions about view shared by several tests
|
||||
|
||||
" ScreenLines(lnum, width) or
|
||||
" ScreenLines([start, end], width)
|
||||
function! ScreenLines(lnum, width) abort
|
||||
redraw!
|
||||
if type(a:lnum) == v:t_list
|
||||
let start = a:lnum[0]
|
||||
let end = a:lnum[1]
|
||||
else
|
||||
let start = a:lnum
|
||||
let end = a:lnum
|
||||
endif
|
||||
let lines = []
|
||||
for l in range(start, end)
|
||||
let lines += [join(map(range(1, a:width), 'nr2char(screenchar(l, v:val))'), '')]
|
||||
endfor
|
||||
return lines
|
||||
endfunction
|
||||
|
||||
function! NewWindow(height, width) abort
|
||||
exe a:height . 'new'
|
||||
exe a:width . 'vsp'
|
||||
redraw!
|
||||
endfunction
|
||||
|
||||
function! CloseWindow() abort
|
||||
bw!
|
||||
redraw!
|
||||
endfunction
|
||||
@@ -779,6 +779,70 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
329,
|
||||
/**/
|
||||
328,
|
||||
/**/
|
||||
327,
|
||||
/**/
|
||||
326,
|
||||
/**/
|
||||
325,
|
||||
/**/
|
||||
324,
|
||||
/**/
|
||||
323,
|
||||
/**/
|
||||
322,
|
||||
/**/
|
||||
321,
|
||||
/**/
|
||||
320,
|
||||
/**/
|
||||
319,
|
||||
/**/
|
||||
318,
|
||||
/**/
|
||||
317,
|
||||
/**/
|
||||
316,
|
||||
/**/
|
||||
315,
|
||||
/**/
|
||||
314,
|
||||
/**/
|
||||
313,
|
||||
/**/
|
||||
312,
|
||||
/**/
|
||||
311,
|
||||
/**/
|
||||
310,
|
||||
/**/
|
||||
309,
|
||||
/**/
|
||||
308,
|
||||
/**/
|
||||
307,
|
||||
/**/
|
||||
306,
|
||||
/**/
|
||||
305,
|
||||
/**/
|
||||
304,
|
||||
/**/
|
||||
303,
|
||||
/**/
|
||||
302,
|
||||
/**/
|
||||
301,
|
||||
/**/
|
||||
300,
|
||||
/**/
|
||||
299,
|
||||
/**/
|
||||
298,
|
||||
/**/
|
||||
297,
|
||||
/**/
|
||||
|
||||
+4
-1
@@ -5713,7 +5713,10 @@ win_new_height(win_T *wp, int height)
|
||||
wp->w_height = height;
|
||||
wp->w_skipcol = 0;
|
||||
|
||||
scroll_to_fraction(wp, prev_height);
|
||||
/* There is no point in adjusting the scroll position when exiting. Some
|
||||
* values might be invalid. */
|
||||
if (!exiting)
|
||||
scroll_to_fraction(wp, prev_height);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user