Compare commits

..

52 Commits

Author SHA1 Message Date
Kazuki Sakamoto b667ee0c63 MacVim Snapshot 127
Binary targets macOS 10.8+

- Vim patch 8.0.0329

Script interfaces have compatibility with these versions

- Lua 5.2
- Perl 5.16
- Python2 2.7
- Python3 3.6
- Ruby 2.0
2017-02-15 18:45:14 -08:00
Kazuki Sakamoto 1fcce8d536 Merge remote-tracking branch 'vim/master' 2017-02-14 21:36:46 -08:00
Bram Moolenaar 1043467482 patch 8.0.0329: xfontset and guifontwide are not tested
Problem:    Xfontset and guifontwide are not tested.
Solution:   Add tests. (Kazunobu Kuriyama)
2017-02-12 19:59:08 +01:00
Bram Moolenaar 23a5558cfd patch 8.0.0328: the "zero count" error doesn't have a number
Problem:    The "zero count" error doesn't have a number. (Hirohito Higashi)
Solution:   Give it a number and be more specific about the error.
2017-02-12 18:45:25 +01:00
Bram Moolenaar 75c19464ed patch 8.0.0327: error message in cmdline window is not translated
Problem:    The E11 error message in the command line window is not
            translated.
Solution:   use _(). (Hirohito Higashi)
2017-02-12 18:34:05 +01:00
Kazuki Sakamoto 9abccb9a5c Merge remote-tracking branch 'vim/master' 2017-02-11 20:33:53 -08:00
Bram Moolenaar 24f8f543d4 patch 8.0.0326: packadd test uses wrong directory name
Problem:    Packadd test uses wrong directory name.
Solution:   Use the variable name value. (Hirohito Higashi)
2017-02-11 23:00:36 +01:00
Bram Moolenaar 913727e567 patch 8.0.0325: packadd test does not clean up symlink
Problem:    Packadd test does not clean up symlink.
Solution:   Delete the link. (Hirohito Higashi)
2017-02-11 11:34:58 +01:00
Kazuki Sakamoto 5f761f85d8 Merge remote-tracking branch 'vim/master' 2017-02-09 18:54:34 -08:00
Bram Moolenaar f1f6f3f7df patch 8.0.0324: illegal memory access with a wrong yank range
Problem:    Illegal memory access with "1;y".
Solution:   Call check_cursor() instead of check_cursor_lnum(). (Dominique
            Pelle, closes #1455)
2017-02-09 22:28:20 +01:00
Bram Moolenaar 31eb139b88 patch 8.0.0323: one second pause when running cmdline test
Problem:    When running the command line tests there is a one second wait.
Solution:   Change an Esc to Ctrl-C. (Yegappan Lakshmanan)
2017-02-09 21:44:03 +01:00
Bram Moolenaar 399c297aa9 patch 8.0.0322: possible overflow with corrupted spell file
Problem:    Possible overflow with spell file where the tree length is
            corrupted.
Solution:   Check for an invalid length (suggested by shqking)
2017-02-09 21:07:12 +01:00
Bram Moolenaar 8cc2a9c062 patch 8.0.0321: errors when trying to use scripts in tiny version
Problem:    When using the tiny version trying to load the matchit plugin
            gives an error. On MS-Windows some default mappings fail.
Solution:   Add a check if the command used is available. (Christian Brabandt)
2017-02-09 20:22:30 +01:00
Bram Moolenaar 4d8505155e patch 8.0.0320: warning for unused variable with small build
Problem:    Warning for unused variable with small build.
Solution:   Change #ifdef to exclude FEAT_CMDWIN. (Kazunobu Kuriyama)
2017-02-09 18:25:14 +01:00
Bram Moolenaar 190b04cdd9 patch 8.0.0319: insert mode completion does not respect 'backspace'
Problem:    Insert mode completion does not respect "start" in 'backspace'.
Solution:   Check whether backspace can go before where insert started.
            (Hirohito Higashi)
2017-02-09 17:37:03 +01:00
Bram Moolenaar a9f8ffb634 patch 8.0.0318: small mistake in 7x13 font name
Problem:    Small mistake in 7x13 font name.
Solution:   Use ISO 8859-1 name instead of 10646-1. (Kazunobu Kuriyama)
2017-02-09 16:14:53 +01:00
Bram Moolenaar 43dded8c59 patch 8.0.0317: no test for setting 'guifont'
Problem:    No test for setting 'guifont'.
Solution:   Add a test for X11 GUIs. (Kazunobu Kuriyama)
2017-02-09 16:06:17 +01:00
Bram Moolenaar dad7309dd2 patch 8.0.0316: :help z? does not work
Problem:    ":help z?" does not work. (Pavol Juhas)
Solution:   Remove exception for z?.
2017-02-09 11:54:50 +01:00
Bram Moolenaar a76f59d817 patch 8.0.0315: :help :[range] does not work
Problem:    ":help :[range]" does not work. (Tony Mechelynck)
Solution:   Translate to insert a backslash.
2017-02-09 11:41:01 +01:00
Kazuki Sakamoto 9235d12894 Merge remote-tracking branch 'vim/master' 2017-02-06 19:42:34 -08:00
Bram Moolenaar 65189a1294 patch 8.0.0314: getcmd*() functions are not tested
Problem:    getcmdtype(), getcmdpos() and getcmdline() are not tested.
Solution:   Add tests. (Yegappan Lakshmanan)
2017-02-06 22:22:17 +01:00
Bram Moolenaar 6f785749db patch 8.0.0313: not enough testing for GUI functionality
Problem:    Not enough testing for GUI functionality.
Solution:   Add tests for the GUI font. (Kazunobu Kuriyama)
2017-02-06 22:11:55 +01:00
Bram Moolenaar 88989cc381 patch 8.0.0312: failure when a channel receives a split json message
Problem:    When a json message arrives in pieces, the start is dropped and
            the decoding fails.
Solution:   Do not drop the start when it is still needed. (Kay Zheng)  Add a
            test.  Reset the timeout when something is received.
2017-02-06 21:56:09 +01:00
Bram Moolenaar 544d3bc9f0 patch 8.0.0311: linebreak tests are old style
Problem:    Linebreak tests are old style.
Solution:   Turn the tests into new style. Share utility functions. (Ozaki
            Kiichi, closes #1444)
2017-02-05 21:14:50 +01:00
Kazuki Sakamoto 78f80e21cb Merge remote-tracking branch 'vim/master' 2017-02-05 11:57:04 -08:00
Bram Moolenaar 13c724fb3a patch 8.0.0310: not enough testing for GUI functionality
Problem:    Not enough testing for GUI functionality.
Solution:   Add tests for v:windowid and getwinpos[xy](). (Kazunobu Kuriyama)
2017-02-05 20:54:26 +01:00
Bram Moolenaar 059b7482a2 patch 8.0.0309: cannot use an empty key in json
Problem:    Cannot use an empty key in json.
Solution:   Allow for using an empty key.
2017-02-05 16:34:43 +01:00
Bram Moolenaar 2f9e575583 patch 8.0.0308: 'runtimepath' not update correctly when using symbolic link
Problem:    When using a symbolic link, the package path will not be inserted
            at the right position in 'runtimepath'. (Dugan Chen, Norio Takagi)
Solution:   Resolve symbolic links when finding the right position in
            'runtimepath'. (Hirohito Higashi)
2017-02-05 16:07:54 +01:00
Bram Moolenaar 955f198fc5 patch 8.0.0307: asan detects a memory error when EXITFREE is defined
Problem:    Asan detects a memory error when EXITFREE is defined. (Dominique
            Pelle)
Solution:   In getvcol() check for ml_get_buf() returning an empty string.
            Also skip adjusting the scroll position.  Set "exiting" in
            mch_exit() for all systems.
2017-02-05 15:10:51 +01:00
Bram Moolenaar e971df39a5 patch 8.0.0306: mode() not sufficiently tested
Problem:    mode() not sufficiently tested.
Solution:   Add more tests. (Yegappan Lakshmanan)
2017-02-05 14:15:29 +01:00
Bram Moolenaar aaaf57d8a9 patch 8.0.0305: invalid memory access when option has duplicate flag
Problem:    Invalid memory access when option has duplicate flag.
Solution:   Correct pointer computation. (Dominique Pelle, closes #1442)
2017-02-05 14:13:20 +01:00
Kazuki Sakamoto c11c152316 Merge remote-tracking branch 'vim/master' 2017-02-04 18:05:40 -08:00
Bram Moolenaar 1fb0d49803 patch 8.0.0304: assign test fails in the GUI
Problem:    Assign test fails in the GUI.
Solution:   Skip the test for setting t_k1.
2017-02-04 21:50:19 +01:00
Bram Moolenaar a1891848d9 patch 8.0.0303: bracketed paste does not work in Visual mode
Problem:    Bracketed paste does not work in Visual mode.
Solution:   Delete the text before pasting
2017-02-04 21:34:31 +01:00
Bram Moolenaar e353c402e6 patch 8.0.0302: cannot set terminal key codes with :let
Problem:    Cannot set terminal key codes with :let.
Solution:   Make it work.
2017-02-04 19:49:16 +01:00
Bram Moolenaar 698f8b207b patch 8.0.0301: not enough testing for setting options
Problem:    No tests for ":set completion" and various errors of the :set
            command.
Solution:   Add more :set tests. (Dominique Pelle, closes #1440)
2017-02-04 15:53:32 +01:00
Bram Moolenaar 25ea054458 patch 8.0.0300: cannot stop diffing hidden buffers
Problem:    Cannot stop diffing hidden buffers. (Daniel Hahler)
Solution:   When using :diffoff! make the whole list if diffed buffers empty.
            (closes #736)
2017-02-03 23:16:28 +01:00
Bram Moolenaar 6b40f30329 patch 8.0.0299: a window resize is sometimes not taking effect
Problem:    When the GUI window is resized Vim does not always take over the
            new size. (Luchr)
Solution:   Reset new_p_guifont in gui_resize_shell().  Call
            gui_may_resize_shell() in the main loop.
2017-02-03 22:01:47 +01:00
Bram Moolenaar cbf20fbcd3 patch 8.0.0298: Ex command range with repeated search does not work
Problem:    Ex command range with repeated search does not work. (Bruce
            DeVisser)
Solution:   Skip over \/, \? and \&.
2017-02-03 21:19:04 +01:00
Kazuki Sakamoto 67c67d1bd2 MacVim Snapshot 126
Binary targets macOS 10.8+

- Vim patch 8.0.0297

Script interfaces have compatibility with these versions

- Lua 5.2
- Perl 5.16
- Python2 2.7
- Python3 3.6
- Ruby 2.0
2017-02-03 07:45:19 -08:00
Kazuki Sakamoto 54e5082d7c Merge remote-tracking branch 'vim/master' 2017-02-02 18:06:17 -08:00
Bram Moolenaar 03ff9bcbc9 patch 8.0.0297: double free on exit when using a closure
Problem:    Double free on exit when using a closure. (James McCoy)
Solution:   Split free_al_functions in two parts. (closes #1428)
2017-02-02 22:59:27 +01:00
Bram Moolenaar fd8983b09c patch 8.0.0296: bracketed paste can only append, not insert
Problem:    Bracketed paste can only append, not insert.
Solution:   When the cursor is in the first column insert the text.
2017-02-02 22:21:29 +01:00
Bram Moolenaar 7a073549a3 patch 8.0.0295: test_viml hangs
Problem:    test_viml hangs.
Solution:   Put resetting 'more' before sourcing the script.
2017-02-01 23:17:36 +01:00
Bram Moolenaar 79da563cf9 patch 8.0.0294: argument list is not stored correctly in a session file
Problem:    Argument list is not stored correctly in a session file.
            (lgpasquale)
Solution:   Use "$argadd" instead of "argadd". (closes #1434)
2017-02-01 22:52:44 +01:00
Bram Moolenaar e5f2a075e3 patch 8.0.0293: some tests have a one or three second wait
Problem:    Some tests have a one or three second wait.
Solution:   Reset the 'showmode' option.  Use a test time of one to disable
            sleep after an error or warning message.
2017-02-01 22:31:49 +01:00
Bram Moolenaar a2f28859bf patch 8.0.0292: the stat test is a bit slow
Problem:    The stat test is a bit slow.
Solution:   Remove a couple of sleep comments and reduce another.
2017-02-01 22:05:28 +01:00
Bram Moolenaar 23fa81d222 patch 8.0.0291: Visual block insertion does not insert in all lines
Problem:    Visual block insertion does not insert in all lines.
Solution:   Don't bail out of insert too early. Add a test. (Christian
            Brabandt, closes #1290)
2017-02-01 21:50:21 +01:00
Bram Moolenaar 04e87b72c5 patch 8.0.0290: cursor positioning wrong if wide character wraps
Problem:    If a wide character doesn't fit at the end of the screen line, and
            the line doesn't fit on the screen, then the cursor position may
            be wrong. (anliting)
Solution:   Don't skip over wide character. (Christian Brabandt, closes #1408)
2017-02-01 21:23:10 +01:00
Bram Moolenaar 21d7c9b601 patch 8.0.0289: no test for "ga" and :ascii
Problem:    No test for "ga" and :ascii.
Solution:   Add a test. (Dominique Pelle, closes #1429)
2017-02-01 20:53:38 +01:00
Bram Moolenaar 4e032e1b17 patch 8.0.0288: errors reported while running tests
Problem:    Errors reported while running tests.
Solution:   Put comma in the right place.
2017-02-01 20:48:13 +01:00
Bram Moolenaar c7d9eacefa patch 8.0.0287: debug mode: cannot access function arguments
Problem:    Cannot access the arguments of the current function in debug mode.
            (Luc Hermitte)
Solution:   use get_funccal(). (Lemonboy, closes #1432, closes #1352)
2017-02-01 20:26:51 +01:00
59 changed files with 1794 additions and 613 deletions
+7 -2
View File
@@ -1,4 +1,4 @@
*term.txt* For Vim version 8.0. Last change: 2017 Jan 27
*term.txt* For Vim version 8.0. Last change: 2017 Feb 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -95,7 +95,12 @@ terminal when entering "raw" mode and 't_BD' when leaving "raw" mode. The
terminal is then expected to put 't_PS' before pasted text and 't_PE' after
pasted text. This way Vim can separate text that is pasted from characters
that are typed. The pasted text is handled like when the middle mouse button
is used.
is used, it is inserted literally and not interpreted as commands.
When the cursor is in the first column, the pasted text will be inserted
before it. Otherwise the pasted text is appended after the cursor position.
This means one cannot paste after the first column. Unfortunately Vim does
not have a way to tell where the mouse pointer was.
Note that in some situations Vim will not recognize the bracketed paste and
you will get the raw text. In other situations Vim will only get the first
+3 -1
View File
@@ -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
View File
@@ -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
+1 -1
View File
@@ -1255,7 +1255,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>125</string>
<string>127</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
+4 -3
View File
@@ -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 \
@@ -2144,8 +2142,9 @@ test_arglist \
test_fnameescape \
test_fnamemodify \
test_fold \
test_glob2regpat \
test_ga \
test_gf \
test_glob2regpat \
test_gn \
test_goto \
test_gui \
@@ -2164,6 +2163,8 @@ test_arglist \
test_langmap \
test_largefile \
test_lispwords \
test_listlbr \
test_listlbr_utf8 \
test_lua \
test_man \
test_mapping \
+27 -19
View File
@@ -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)
+4
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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);
}
+13 -6
View File
@@ -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;
@@ -11825,7 +11832,7 @@ ses_arglist(
s = buf;
}
}
if (fputs("argadd ", fd) < 0
if (fputs("$argadd ", fd) < 0
|| ses_put_fname(fd, s, flagp) == FAIL
|| put_eol(fd) == FAIL)
{
+1 -2
View File
@@ -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
View File
@@ -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
+18 -19
View File
@@ -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
View File
@@ -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));
+4
View File
@@ -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 && (
+5 -1
View File
@@ -3264,7 +3264,11 @@ change_warning(
#endif
msg_clr_eos();
(void)msg_end();
if (msg_silent == 0 && !silent_mode)
if (msg_silent == 0 && !silent_mode
#ifdef FEAT_EVAL
&& time_for_testing != 1
#endif
)
{
out_flush();
ui_delay(1000L, TRUE); /* give the user time to think about it */
+35 -1
View File
@@ -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,14 @@ 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. */
if (curwin->w_cursor.col == 0)
break;
/*FALLTHROUGH*/
case 'a': /* "a"ppend is like "i"nsert on the next character. */
case K_PS: /* bracketed paste works like "a"ppend */
#ifdef FEAT_VIRTUALEDIT
/* increment coladd when in virtual space, increment the
* column otherwise, also to append after an unprintable char */
+18 -8
View File
@@ -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;
}
@@ -2571,8 +2582,7 @@ op_insert(oparg_T *oap, long count1)
}
t1 = oap->start;
if (edit(NUL, FALSE, (linenr_T)count1))
return;
(void)edit(NUL, FALSE, (linenr_T)count1);
/* When a tab was inserted, and the characters in front of the tab
* have been converted to a tab as well, the column of the cursor
+58 -3
View File
@@ -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;
+2
View File
@@ -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);
+2
View File
@@ -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
View File
@@ -2538,8 +2538,9 @@ mch_init(void)
void
mch_exit(int r)
{
stoptermcap();
exiting = TRUE;
stoptermcap();
if (g_fWindInitCalled)
settmode(TMODE_COOK);
+1
View File
@@ -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);
+6 -2
View File
@@ -2903,7 +2903,7 @@ win_line(
int endrow,
int nochange UNUSED) /* not updating for changed text */
{
int col; /* visual column on screen */
int col = 0; /* visual column on screen */
unsigned off; /* offset in ScreenLines/ScreenAttrs */
int c = 0; /* init for GCC */
long vcol = 0; /* virtual column (for tabs) */
@@ -3429,7 +3429,11 @@ win_line(
#else
--ptr;
#endif
n_skip = v - vcol;
#ifdef FEAT_MBYTE
/* character fits on the screen, don't need to skip it */
if ((*mb_ptr2cells)(ptr) >= c && col == 0)
#endif
n_skip = v - vcol;
}
/*
+3
View File
@@ -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. */
+6 -3
View File
@@ -1337,6 +1337,7 @@ typedef struct
int uf_varargs; /* variable nr of arguments */
int uf_flags;
int uf_calls; /* nr of active calls */
int uf_cleared; /* func_clear() was already called */
garray_T uf_args; /* arguments */
garray_T uf_lines; /* function lines */
#ifdef FEAT_PROFILE
@@ -1565,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
+3 -3
View File
@@ -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 \
+9 -2
View File
@@ -88,6 +88,14 @@ endfunc
function RunTheTest(test)
echo 'Executing ' . a:test
" Avoid stopping at the "hit enter" prompt
set nomore
" Avoid a three second wait when a message is about to be overwritten by the
" mode message.
set noshowmode
if exists("*SetUp")
try
call SetUp()
@@ -158,12 +166,11 @@ let s:flaky = [
\ 'Test_communicate()',
\ 'Test_nb_basic()',
\ 'Test_pipe_through_sort_all()',
\ 'Test_pipe_through_sort_some()'
\ 'Test_pipe_through_sort_some()',
\ 'Test_reltime()',
\ ]
" Locate Test_ functions and execute them.
set nomore
redir @q
silent function /^Test_
redir END
+1
View File
@@ -19,6 +19,7 @@ source test_float_func.vim
source test_fnamemodify.vim
source test_functions.vim
source test_glob2regpat.vim
source test_ga.vim
source test_goto.vim
source test_help_tagjump.vim
source test_join.vim
+22
View File
@@ -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
+152 -94
View File
@@ -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
+11 -1
View File
@@ -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
+5
View File
@@ -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()
+69 -1
View File
@@ -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&
+37
View File
@@ -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)
+34
View File
@@ -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))
+37
View File
@@ -0,0 +1,37 @@
" Test ga normal command, and :ascii Ex command.
func Do_ga(c)
call setline(1, a:c)
let l:a = execute("norm 1goga")
let l:b = execute("ascii")
call assert_equal(l:a, l:b)
return l:a
endfunc
func Test_ga_command()
new
set display=uhex
call assert_equal("\nNUL", Do_ga(''))
call assert_equal("\n<<01>> 1, Hex 01, Octal 001", Do_ga("\x01"))
call assert_equal("\n<<09>> 9, Hex 09, Octal 011", Do_ga("\t"))
set display=
call assert_equal("\nNUL", Do_ga(''))
call assert_equal("\n<^A> 1, Hex 01, Octal 001", Do_ga("\x01"))
call assert_equal("\n<^I> 9, Hex 09, Octal 011", Do_ga("\t"))
call assert_equal("\n<e> 101, Hex 65, Octal 145", Do_ga('e'))
if !has('multi_byte')
return
endif
" Test a few multi-bytes characters.
call assert_equal("\n<é> 233, Hex 00e9, Octal 351", Do_ga('é'))
call assert_equal("\n<ẻ> 7867, Hex 1ebb, Octal 17273", Do_ga('ẻ'))
" Test with combining characters.
call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401", Do_ga("e\u0301"))
call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461", Do_ga("e\u0301\u0331"))
call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461 < ̸> 824, Hex 0338, Octal 1470", Do_ga("e\u0301\u0331\u0338"))
bwipe!
endfunc
+255 -1
View File
@@ -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
+5
View File
@@ -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:')
-119
View File
@@ -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
-62
View File
@@ -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-$
~
+219
View File
@@ -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
-134
View File
@@ -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
-57
View File
@@ -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!
+195
View File
@@ -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
+12
View File
@@ -110,4 +110,16 @@ func Test_mksession_winheight()
call delete('Xtest_mks.out')
endfunc
func Test_mksession_arglist()
argdel *
next file1 file2 file3 file4
mksession! Xtest_mks.out
source Xtest_mks.out
call assert_equal(['file1', 'file2', 'file3', 'file4'], argv())
call delete('Xtest_mks.out')
argdel *
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+3
View File
@@ -2193,6 +2193,8 @@ func! Test_normal51_FileChangedRO()
if !has("autocmd")
return
endif
" Don't sleep after the warning message.
call test_settime(1)
call writefile(['foo'], 'Xreadonly.log')
new Xreadonly.log
setl ro
@@ -2202,6 +2204,7 @@ func! Test_normal51_FileChangedRO()
call assert_equal('Xreadonly.log', bufname(''))
" cleanup
call test_settime(0)
bw!
call delete("Xreadonly.log")
endfunc
+97
View File
@@ -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
+34
View File
@@ -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'
+49 -4
View File
@@ -8,18 +8,36 @@ set term=xterm
func Test_paste_normal_mode()
new
" In first column text is inserted
call setline(1, ['a', 'b', 'c'])
2
call cursor(2, 1)
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
call assert_equal('bfoo', getline(2))
call assert_equal('bar', getline(3))
call assert_equal('foo', getline(2))
call assert_equal('barb', getline(3))
call assert_equal('c', getline(4))
" When repeating text is appended
normal .
call assert_equal('barfoo', getline(3))
call assert_equal('bar', getline(4))
call assert_equal('barb', getline(4))
call assert_equal('c', getline(5))
bwipe!
" In second column text is appended
call setline(1, ['a', 'bbb', 'c'])
call cursor(2, 2)
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
call assert_equal('bbfoo', getline(2))
call assert_equal('barb', getline(3))
call assert_equal('c', getline(4))
" In last column text is appended
call setline(1, ['a', 'bbb', 'c'])
call cursor(2, 3)
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
call assert_equal('bbbfoo', getline(2))
call assert_equal('bar', getline(3))
call assert_equal('c', getline(4))
endfunc
func Test_paste_insert_mode()
@@ -52,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
+20
View File
@@ -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
+21 -14
View File
@@ -1,24 +1,24 @@
" Tests for stat functions and checktime
func Test_existent_file()
let fname='Xtest.tmp'
let fname = 'Xtest.tmp'
let ts=localtime()
sleep 1
let fl=['Hello World!']
let ts = localtime()
let fl = ['Hello World!']
call writefile(fl, fname)
let tf=getftime(fname)
sleep 1
let te=localtime()
let tf = getftime(fname)
let te = localtime()
call assert_true(ts <= tf && tf <= te)
call assert_equal(strlen(fl[0] . "\n"), getfsize(fname))
call assert_equal('file', getftype(fname))
call assert_equal('rw-', getfperm(fname)[0:2])
call delete(fname)
endfunc
func Test_existent_directory()
let dname='.'
let dname = '.'
call assert_equal(0, getfsize(dname))
call assert_equal('dir', getftype(dname))
@@ -26,22 +26,29 @@ func Test_existent_directory()
endfunc
func Test_checktime()
let fname='Xtest.tmp'
let fname = 'Xtest.tmp'
let fl=['Hello World!']
let fl = ['Hello World!']
call writefile(fl, fname)
set autoread
exec 'e' fname
sleep 2
let fl=readfile(fname)
" FAT has a granularity of 2 seconds, otherwise it's usually 1 second
if has('win32')
sleep 2
else
sleep 1
endif
let fl = readfile(fname)
let fl[0] .= ' - checktime'
call writefile(fl, fname)
checktime
call assert_equal(fl[0], getline(1))
call delete(fname)
endfunc
func Test_nonexistent_file()
let fname='Xtest.tmp'
let fname = 'Xtest.tmp'
call delete(fname)
call assert_equal(-1, getftime(fname))
@@ -55,7 +62,7 @@ func Test_win32_symlink_dir()
" So we use an existing symlink for this test.
if has('win32')
" Check if 'C:\Users\All Users' is a symlink to a directory.
let res=system('dir C:\Users /a')
let res = system('dir C:\Users /a')
if match(res, '\C<SYMLINKD> *All Users') >= 0
" Get the filetype of the symlink.
call assert_equal('dir', getftype('C:\Users\All Users'))
+13
View File
@@ -23,3 +23,16 @@ func Test_dotregister_paste()
call assert_equal('hello world world', getline(1))
q!
endfunc
func Test_Visual_ctrl_o()
new
call setline(1, ['one', 'two', 'three'])
call cursor(1,2)
set noshowmode
set tw=0
call feedkeys("\<c-v>jjlIa\<c-\>\<c-o>:set tw=88\<cr>\<esc>", 'tx')
call assert_equal(['oane', 'tawo', 'tahree'], getline(1, 3))
call assert_equal(88, &tw)
set tw&
bw!
endfu
+30
View File
@@ -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
+67 -13
View File
@@ -1075,12 +1075,17 @@ func_remove(ufunc_T *fp)
}
/*
* Free a function and remove it from the list of functions.
* Free all things that a function contains. Does not free the function
* itself, use func_free() for that.
* When "force" is TRUE we are exiting.
*/
static void
func_free(ufunc_T *fp, int force)
func_clear(ufunc_T *fp, int force)
{
if (fp->uf_cleared)
return;
fp->uf_cleared = TRUE;
/* clear this function */
ga_clear_strings(&(fp->uf_args));
ga_clear_strings(&(fp->uf_lines));
@@ -1089,16 +1094,35 @@ func_free(ufunc_T *fp, int force)
vim_free(fp->uf_tml_total);
vim_free(fp->uf_tml_self);
#endif
funccal_unref(fp->uf_scoped, fp, force);
}
/*
* Free a function and remove it from the list of functions. Does not free
* what a function contains, call func_clear() first.
*/
static void
func_free(ufunc_T *fp)
{
/* only remove it when not done already, otherwise we would remove a newer
* version of the function */
if ((fp->uf_flags & (FC_DELETED | FC_REMOVED)) == 0)
func_remove(fp);
funccal_unref(fp->uf_scoped, fp, force);
vim_free(fp);
}
/*
* Free all things that a function contains and free the function itself.
* When "force" is TRUE we are exiting.
*/
static void
func_clear_free(ufunc_T *fp, int force)
{
func_clear(fp, force);
func_free(fp);
}
/*
* There are two kinds of function names:
* 1. ordinary names, function defined with :function
@@ -1120,10 +1144,40 @@ free_all_functions(void)
hashitem_T *hi;
ufunc_T *fp;
long_u skipped = 0;
long_u todo;
long_u todo = 1;
long_u used;
/* Need to start all over every time, because func_free() may change the
* hash table. */
/* First clear what the functions contain. Since this may lower the
* reference count of a function, it may also free a function and change
* the hash table. Restart if that happens. */
while (todo > 0)
{
todo = func_hashtab.ht_used;
for (hi = func_hashtab.ht_array; todo > 0; ++hi)
if (!HASHITEM_EMPTY(hi))
{
/* Only free functions that are not refcounted, those are
* supposed to be freed when no longer referenced. */
fp = HI2UF(hi);
if (func_name_refcount(fp->uf_name))
++skipped;
else
{
used = func_hashtab.ht_used;
func_clear(fp, TRUE);
if (used != func_hashtab.ht_used)
{
skipped = 0;
break;
}
}
--todo;
}
}
/* Now actually free the functions. Need to start all over every time,
* because func_free() may change the hash table. */
skipped = 0;
while (func_hashtab.ht_used > skipped)
{
todo = func_hashtab.ht_used;
@@ -1138,7 +1192,7 @@ free_all_functions(void)
++skipped;
else
{
func_free(fp, TRUE);
func_free(fp);
skipped = 0;
break;
}
@@ -1356,7 +1410,7 @@ call_func(
if (--fp->uf_calls <= 0 && fp->uf_refcount <= 0)
/* Function was unreferenced while being used, free it
* now. */
func_free(fp, FALSE);
func_clear_free(fp, FALSE);
if (did_save_redo)
restoreRedobuff();
restore_search_patterns();
@@ -2756,7 +2810,7 @@ ex_delfunction(exarg_T *eap)
fp->uf_flags |= FC_DELETED;
}
else
func_free(fp, FALSE);
func_clear_free(fp, FALSE);
}
}
}
@@ -2785,7 +2839,7 @@ func_unref(char_u *name)
/* Only delete it when it's not being used. Otherwise it's done
* when "uf_calls" becomes zero. */
if (fp->uf_calls == 0)
func_free(fp, FALSE);
func_clear_free(fp, FALSE);
}
}
@@ -2801,7 +2855,7 @@ func_ptr_unref(ufunc_T *fp)
/* Only delete it when it's not being used. Otherwise it's done
* when "uf_calls" becomes zero. */
if (fp->uf_calls == 0)
func_free(fp, FALSE);
func_clear_free(fp, FALSE);
}
}
@@ -3556,7 +3610,7 @@ get_funccal_args_var()
{
if (current_funccal == NULL)
return NULL;
return &current_funccal->l_avars_var;
return &get_funccal()->l_avars_var;
}
/*
+86
View File
@@ -779,6 +779,92 @@ 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,
/**/
296,
/**/
295,
/**/
294,
/**/
293,
/**/
292,
/**/
291,
/**/
290,
/**/
289,
/**/
288,
/**/
287,
/**/
286,
/**/
+4 -1
View File
@@ -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