Compare commits

...

46 Commits

Author SHA1 Message Date
Kazuki Sakamoto 6480401b5c MacVim Snapshot 106
Binary targets OS X 10.8(Mountain Lion), 10.9(Mavericks), 10.10(Yosemite), and 10.11(El Capitan)

- Vim patch 7.4.2196

Script interfaces have compatibility with these versions

- Lua 5.2
- Perl 5.16
- Python2 2.7
- Python3 3.5
- Ruby 2.0
2016-08-10 19:14:47 -07:00
Kazuki Sakamoto b0501922f1 Merge remote-tracking branch 'vim/master' 2016-08-10 19:08:32 -07:00
Kazuki Sakamoto 8df28f3029 Merge pull request #319 from macvim-dev/fix/winrestview
Fix winrestview
2016-08-10 18:06:48 -07:00
Bram Moolenaar 91c5262b19 patch 7.4.2196
Problem:    glob2regpat test doesn't test everything on MS-Windows.
Solution:   Add patterns with backslash handling.
2016-08-10 23:02:45 +02:00
Bram Moolenaar bcc1dcc981 patch 7.4.2195
Problem:    MS-Windows: The vimrun program does not support Unicode.
Solution:   Use GetCommandLineW().  Cleanup old #ifdefs. (Ken Takata)
2016-08-10 22:02:40 +02:00
Bram Moolenaar 446a973ce3 patch 7.4.2194
Problem:    Sign tests don't cover enough.
Solution:   Add more test cases. (Dominique Pelle)
2016-08-10 21:36:23 +02:00
Bram Moolenaar 717e196060 patch 7.4.2193
Problem:    With Gnome when the GUI can't start test_startup hangs.
Solution:   Call gui_mch_early_init_check(). (Hirohito Higashi)
2016-08-10 21:28:44 +02:00
Bram Moolenaar a6b7a08ae0 patch 7.4.2192
Problem:    Generating prototypes with Cygwin doesn't work well.
Solution:   Change #ifdefs. (Ken Takata)
2016-08-10 20:53:05 +02:00
Bram Moolenaar a357e44ccd patch 7.4.2191
Problem:    No automatic prototype for vim_main2().
Solution:   Move the #endif. (Ken Takata)
2016-08-10 20:45:07 +02:00
Kazuki Sakamoto a1977aa8d2 Fix winrestview 2016-08-09 23:24:56 -07:00
Kazuki Sakamoto 8d7a68e9fa Merge remote-tracking branch 'vim/master' 2016-08-09 20:20:41 -07:00
Bram Moolenaar 50fa8dd00c patch 7.4.2190
Problem:    When startup test fails it's not easy to find out why.
            GUI test fails with Gnome.
Solution:   Add the help entry matches to a list an assert that.
            Set $HOME for Gnome to create .gnome2 directory.
2016-08-09 22:58:21 +02:00
Bram Moolenaar f71d7b9ee5 patch 7.4.2189
Problem:    Cannot detect encoding in a fifo.
Solution:   Extend the stdin way of detecting encoding to fifo.  Add a test
            for detecting encoding on stdin and fifo. (Ken Takata)
2016-08-09 22:14:05 +02:00
Bram Moolenaar c9fb77c692 patch 7.4.2188
Problem:    Completion does not work properly with some plugins.
Solution:   Revert the part related to typing CTRL-E. (closes #972)
2016-08-09 21:51:40 +02:00
Kazuki Sakamoto 3a0c5e14c6 Merge pull request #317 from macvim-dev/fix/workaround_timer
Workaround fix: Relax timer in tests
2016-08-08 22:14:56 -07:00
Kazuki Sakamoto 51073cf6d0 Workaround fix: Relax timer in tests 2016-08-08 22:13:51 -07:00
Kazuki Sakamoto 064b366275 Merge remote-tracking branch 'vim/master' 2016-08-08 19:27:01 -07:00
Bram Moolenaar 7547a78446 patch 7.4.2187
Problem:    glob2regpat test fails on Windows.
Solution:   Remove the checks that use backslashes.
2016-08-08 23:26:51 +02:00
Bram Moolenaar 36d1c0fef4 patch 7.4.2186
Problem:    Timers test is flaky.
Solution:   Relax the sleep time check.
2016-08-08 22:46:14 +02:00
Bram Moolenaar 71dd9744cf patch 7.4.2185
Problem:    Test glob2regpat does not test much.
Solution:   Add a few more test cases. (Dominique Pelle)
2016-08-08 22:42:04 +02:00
Bram Moolenaar 7a9a5f4019 patch 7.4.2184
Problem:    Tests that use RunVim() do not actually perform the test.
Solution:   Use "return" instead of "call". (Ken Takata)
2016-08-08 22:34:14 +02:00
Bram Moolenaar 09de17536d patch 7.4.2183
Problem:    Sign tests are old style.
Solution:   Turn them into new style tests. (Dominique Pelle)
2016-08-08 22:26:48 +02:00
Bram Moolenaar 2147746cf8 patch 7.4.2182
Problem:    Color Grey40 used in startup but not in the short list.
Solution:   Add Grey40 to the builtin colors.
2016-08-08 20:43:27 +02:00
Kazuki Sakamoto fa4076a018 Merge remote-tracking branch 'vim/master' 2016-08-07 18:16:58 -07:00
Bram Moolenaar a772ec5e91 patch 7.4.2181
Problem:    Compiler warning for unused variable.
Solution:   Remove it. (Dominique Pelle)
2016-08-07 20:20:50 +02:00
Bram Moolenaar b73598e2f0 patch 7.4.2180
Problem:    There is no easy way to stop all timers.  There is no way to
            temporary pause a timer.
Solution:   Add timer_stopall() and timer_pause().
2016-08-07 18:22:53 +02:00
Bram Moolenaar e4a76ad0e7 patch 7.4.2179
Problem:    Reading from stdin test fails on MS-Windows.
Solution:   Strip the extra space.
2016-08-07 16:50:10 +02:00
Bram Moolenaar 3a93838339 patch 7.4.2178
Problem:    No test for reading from stdin.
Solution:   Add a test.
2016-08-07 16:36:40 +02:00
Bram Moolenaar ba98bef191 patch 7.4.2177
Problem:    No testing for -C and -N command line flags, file arguments,
            startuptime.
Solution:   Add tests.
2016-08-07 15:51:39 +02:00
Bram Moolenaar a8e691d449 patch 7.4.2176
Problem:    #ifdefs in main() are complicated.
Solution:   Always define vim_main2().  Move params to the file level.
            (suggested by Ken Takata)
2016-08-07 15:19:26 +02:00
Bram Moolenaar 812ad4f3a2 patch 7.4.2175
Problem:    Insufficient testing of cscope.
Solution:   Add more tests. (Dominique Pelle)
2016-08-07 14:03:13 +02:00
Bram Moolenaar c8ce615299 patch 7.4.2174
Problem:    Adding duplicate flags to 'whichwrap' leaves commas behind.
Solution:   Also remove the commas. (Naruhiko Nishino)
2016-08-07 13:48:20 +02:00
Kazuki Sakamoto 66dc68524d Merge remote-tracking branch 'vim/master' 2016-08-06 22:11:08 -07:00
Bram Moolenaar 3321e9d8a3 patch 7.4.2173
Problem:    Can't test help on MS-Windows.
Solution:   Skip the test.
2016-08-06 23:03:59 +02:00
Bram Moolenaar 472a0a880a patch 7.4.2172
Problem:    No test for "vim --help".
Solution:   Add a test.
2016-08-06 22:31:42 +02:00
Bram Moolenaar 00ff380295 patch 7.4.2171
Problem:    MS-Windows build fails.
Solution:   Add QueryPerformanceCounter().
2016-08-06 22:27:28 +02:00
Bram Moolenaar 8e97bd74b5 patch 7.4.2170
Problem:    Cannot get information about timers.
Solution:   Add timer_info().
2016-08-06 22:05:07 +02:00
Bram Moolenaar 446cce6d53 patch 7.4.2169
Problem:    Startup test gets stuck on MS-Windows.
Solution:   Use double quotes.
2016-08-06 21:37:27 +02:00
Bram Moolenaar 5b4a3767f6 patch 7.4.2168
Problem:    Not running the startup test on MS-Windows.
Solution:   Write vimcmd.
2016-08-06 20:36:34 +02:00
Bram Moolenaar c96a2f3b88 patch 7.4.2167
Problem:    Small build can't run tests.
Solution:   Don't try setting 'packpath'.
2016-08-06 19:45:31 +02:00
Bram Moolenaar 328604307b patch 7.4.2166
Problem:    Small build can't run startup test.
Solution:   Skip the test.
2016-08-06 19:24:23 +02:00
Bram Moolenaar 83b3c3d8a0 patch 7.4.2165
Problem:    Startup test fails on MS-Windows.
Solution:   Don't check output if RunVim() returns zero.
2016-08-06 19:16:43 +02:00
Bram Moolenaar 66459b7c98 patch 7.4.2164
Problem:    It is not possible to use plugins in an "after" directory to tune
            the behavior of a package.
Solution:   First load plugins from non-after directories, then packages and
            finally plugins in after directories.
            Reset 'loadplugins' before executing --cmd arguments.
2016-08-06 19:01:55 +02:00
Bram Moolenaar d76a0c15f8 patch 7.4.2163
Problem:    match() and related functions tested with old style test.
Solution:   Convert to new style test. (Hirohito Higashi)
2016-08-06 15:29:22 +02:00
Bram Moolenaar 7522f69821 patch 7.4.2162
Problem:    Result of getcompletion('', 'sign') depends on previous
            completion.
Solution:   Call set_context_in_sign_cmd(). (Dominique Pelle)
2016-08-06 14:12:50 +02:00
Kazuki Sakamoto c6b93c1711 Add GUI test in .travis.yml 2016-08-05 23:54:18 -07:00
59 changed files with 1625 additions and 662 deletions
+2
View File
@@ -41,6 +41,8 @@ script:
- rm -f result; $VIMCMD -g -f -c "redir>result" -c "py3 print(\"Test\")" -c "redir END" -c q; cat result; echo; grep -q -w Test result
- rm -f result; $VIMCMD -g -f -c "redir>result" -c "ruby puts(\"Test\")" -c "redir END" -c q; cat result; echo; grep -q -w Test result
- make test
- make -C src/testdir clean
- make -C src testgui
before_deploy:
- make -C src macvim-dmg
+60 -8
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2016 Aug 02
*eval.txt* For Vim version 7.4. Last change: 2016 Aug 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1969,7 +1969,7 @@ assert_exception({error} [, {msg}]) none assert {error} is in v:exception
assert_fails({cmd} [, {error}]) none assert {cmd} fails
assert_false({actual} [, {msg}]) none assert {actual} is false
assert_inrange({lower}, {upper}, {actual} [, {msg}])
none assert {actual} is inside the range
none assert {actual} is inside the range
assert_match({pat}, {text} [, {msg}]) none assert {pat} matches {text}
assert_notequal({exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
assert_notmatch({pat}, {text} [, {msg}]) none assert {pat} not matches {text}
@@ -2339,9 +2339,12 @@ test_null_list() List null value for testing
test_null_partial() Funcref null value for testing
test_null_string() String null value for testing
test_settime({expr}) none set current time for testing
timer_info([{id}]) List information about timers
timer_pause({id}, {pause}) none pause or unpause a timer
timer_start({time}, {callback} [, {options}])
Number create a timer
timer_stop({timer}) none stop a timer
timer_stopall() none stop all timers
tolower({expr}) String the String {expr} switched to lowercase
toupper({expr}) String the String {expr} switched to uppercase
tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
@@ -3392,9 +3395,13 @@ exepath({expr}) *exepath()*
an empty string is returned.
*exists()*
exists({expr}) The result is a Number, which is |TRUE| if {expr} is
defined, zero otherwise. The {expr} argument is a string,
which contains one of these:
exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined,
zero otherwise.
For checking for a supported feature use |has()|.
For checking if a file exists use |filereadable()|.
The {expr} argument is a string, which contains one of these:
&option-name Vim option (only checks if it exists,
not if it really works)
+option-name Vim option that works.
@@ -3442,7 +3449,6 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is
event and pattern.
##event autocommand for this event is
supported.
For checking for a supported feature use |has()|.
Examples: >
exists("&shortname")
@@ -5476,7 +5482,8 @@ matchadd({group}, {pattern}[, {priority}[, {id}[, {dict}]]])
available from |getmatches()|. All matches can be deleted in
one operation by |clearmatches()|.
matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) *matchaddpos()*
*matchaddpos()*
matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]])
Same as |matchadd()|, but requires a list of positions {pos}
instead of a pattern. This command is faster than |matchadd()|
because it does not require to handle regular expressions and
@@ -7536,6 +7543,41 @@ test_settime({expr}) *test_settime()*
{expr} must evaluate to a number. When the value is zero the
normal behavior is restored.
*timer_info()*
timer_info([{id}])
Return a list with information about timers.
When {id} is given only information about this timer is
returned. When timer {id} does not exist an empty list is
returned.
When {id} is omitted information about all timers is returned.
For each timer the information is stored in a Dictionary with
these items:
"id" the timer ID
"time" time the timer was started with
"remaining" time until the timer fires
"repeat" number of times the timer will still fire;
-1 means forever
"callback" the callback
"paused" 1 if the timer is paused, 0 otherwise
{only available when compiled with the |+timers| feature}
timer_pause({timer}, {paused}) *timer_pause()*
Pause or unpause a timer. A paused timer does not invoke its
callback, while the time it would is not changed. Unpausing a
timer may cause the callback to be invoked almost immediately
if enough time has passed.
Pausing a timer is useful to avoid the callback to be called
for a short time.
If {paused} evaluates to a non-zero Number or a non-empty
String, then the timer is paused, otherwise it is unpaused.
See |non-zero-arg|.
{only available when compiled with the |+timers| feature}
*timer_start()*
timer_start({time}, {callback} [, {options}])
Create a timer and return the timer ID.
@@ -7561,12 +7603,22 @@ timer_start({time}, {callback} [, {options}])
\ {'repeat': 3})
< This will invoke MyHandler() three times at 500 msec
intervals.
{only available when compiled with the |+timers| feature}
timer_stop({timer}) *timer_stop()*
Stop a timer. The timer callback will no longer be invoked.
{timer} is an ID returned by timer_start(), thus it must be a
Number.
Number. If {timer} does not exist there is no error.
{only available when compiled with the |+timers| feature}
timer_stopall() *timer_stopall()*
Stop all timers. The timer callbacks will no longer be
invoked. Useful if some timers is misbehaving. If there are
no timers there is no error.
{only available when compiled with the |+timers| feature}
tolower({expr}) *tolower()*
The result is a copy of the String given, with all uppercase
+9 -2
View File
@@ -1,4 +1,4 @@
*starting.txt* For Vim version 7.4. Last change: 2016 Jul 29
*starting.txt* For Vim version 7.4. Last change: 2016 Aug 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -859,6 +859,8 @@ accordingly. Vim proceeds in this order:
searched for the "plugin" sub-directory and all files ending in ".vim"
will be sourced (in alphabetical order per directory), also in
subdirectories.
However, directories in 'runtimepath' ending in "after" are skipped
here and only loaded after packages, see below.
Loading plugins won't be done when:
- The 'loadplugins' option was reset in a vimrc file.
- The |--noplugin| command line argument is used.
@@ -866,13 +868,18 @@ accordingly. Vim proceeds in this order:
- When Vim was compiled without the |+eval| feature.
Note that using "-c 'set noloadplugins'" doesn't work, because the
commands from the command line have not been executed yet. You can
use "--cmd 'set noloadplugins'" |--cmd|.
use "--cmd 'set noloadplugins'" or "--cmd 'set loadplugins'" |--cmd|.
Packages are loaded. These are plugins, as above, but found in the
"start" directory of each entry in 'packpath'. Every plugin directory
found is added in 'runtimepath' and then the plugins are sourced. See
|packages|.
The plugins scripts are loaded, as above, but now only the directories
ending in "after" are used. Note that 'runtimepath' will have changed
if packages have been found, but that should not add a directory
ending in "after".
5. Set 'shellpipe' and 'shellredir'
The 'shellpipe' and 'shellredir' options are set according to the
value of the 'shell' option, unless they have been set before.
+1 -1
View File
@@ -1255,7 +1255,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>105</string>
<string>106</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
+6 -5
View File
@@ -2048,9 +2048,7 @@ test1 \
test_mapping \
test_marks \
test_nested_function \
test_options \
test_search_mbyte \
test_signs \
test_tagcase \
test_utf8 \
test_wordcount \
@@ -2061,7 +2059,7 @@ test1 \
test30 test31 test32 test33 test34 test36 test37 test38 test39 \
test40 test41 test42 test43 test44 test45 test46 test48 test49 \
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
test60 test62 test63 test64 test65 test66 test67 test68 test69 \
test60 test62 test64 test65 test66 test67 test68 test69 \
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
test90 test91 test92 test93 test94 test95 test97 test98 test99 \
@@ -2112,12 +2110,13 @@ test_arglist \
test_largefile \
test_lispwords \
test_man \
test_match \
test_matchadd_conceal \
test_matchadd_conceal_utf8 \
test_matchstrpos \
test_menu \
test_messages \
test_netbeans \
test_options \
test_packadd \
test_partial \
test_perl \
@@ -2127,10 +2126,12 @@ test_arglist \
test_regexp_utf8 \
test_reltime \
test_ruby \
test_startup \
test_searchpos \
test_set \
test_signs \
test_sort \
test_startup \
test_startup_utf8 \
test_stat \
test_statusline \
test_syn_attr \
+89 -41
View File
@@ -70,6 +70,64 @@ static char *e_auabort = N_("E855: Autocommands caused command to abort");
/* Number of times free_buffer() was called. */
static int buf_free_count = 0;
/* Read data from buffer for retrying. */
static int
read_buffer(
int read_stdin, /* read file from stdin, otherwise fifo */
exarg_T *eap, /* for forced 'ff' and 'fenc' or NULL */
int flags) /* extra flags for readfile() */
{
int retval = OK;
linenr_T line_count;
/*
* Read from the buffer which the text is already filled in and append at
* the end. This makes it possible to retry when 'fileformat' or
* 'fileencoding' was guessed wrong.
*/
line_count = curbuf->b_ml.ml_line_count;
retval = readfile(
read_stdin ? NULL : curbuf->b_ffname,
read_stdin ? NULL : curbuf->b_fname,
(linenr_T)line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap,
flags | READ_BUFFER);
if (retval == OK)
{
/* Delete the binary lines. */
while (--line_count >= 0)
ml_delete((linenr_T)1, FALSE);
}
else
{
/* Delete the converted lines. */
while (curbuf->b_ml.ml_line_count > line_count)
ml_delete(line_count, FALSE);
}
/* Put the cursor on the first line. */
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
if (read_stdin)
{
/* Set or reset 'modified' before executing autocommands, so that
* it can be changed there. */
if (!readonlymode && !bufempty())
changed();
else if (retval != FAIL)
unchanged(curbuf, FALSE);
#ifdef FEAT_AUTOCMD
# ifdef FEAT_EVAL
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
curbuf, &retval);
# else
apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
# endif
#endif
}
return retval;
}
/*
* Open current buffer, that is: open the memfile and read the file into
* memory.
@@ -88,6 +146,7 @@ open_buffer(
#ifdef FEAT_SYN_HL
long old_tw = curbuf->b_p_tw;
#endif
int read_fifo = FALSE;
/*
* The 'readonly' flag is only set when BF_NEVERLOADED is being reset.
@@ -143,17 +202,42 @@ open_buffer(
)
{
int old_msg_silent = msg_silent;
#ifdef UNIX
int save_bin = curbuf->b_p_bin;
int perm;
#endif
#ifdef FEAT_NETBEANS_INTG
int oldFire = netbeansFireChanges;
netbeansFireChanges = 0;
#endif
#ifdef UNIX
perm = mch_getperm(curbuf->b_ffname);
if (perm >= 0 && (0
# ifdef S_ISFIFO
|| S_ISFIFO(perm)
# endif
# ifdef S_ISSOCK
|| S_ISSOCK(perm)
# endif
))
read_fifo = TRUE;
if (read_fifo)
curbuf->b_p_bin = TRUE;
#endif
if (shortmess(SHM_FILEINFO))
msg_silent = 1;
retval = readfile(curbuf->b_ffname, curbuf->b_fname,
(linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap,
flags | READ_NEW);
flags | READ_NEW | (read_fifo ? READ_FIFO : 0));
#ifdef UNIX
if (read_fifo)
{
curbuf->b_p_bin = save_bin;
if (retval == OK)
retval = read_buffer(FALSE, eap, flags);
}
#endif
msg_silent = old_msg_silent;
#ifdef FEAT_NETBEANS_INTG
netbeansFireChanges = oldFire;
@@ -164,8 +248,7 @@ open_buffer(
}
else if (read_stdin)
{
int save_bin = curbuf->b_p_bin;
linenr_T line_count;
int save_bin = curbuf->b_p_bin;
/*
* First read the text in binary mode into the buffer.
@@ -179,42 +262,7 @@ open_buffer(
flags | (READ_NEW + READ_STDIN));
curbuf->b_p_bin = save_bin;
if (retval == OK)
{
line_count = curbuf->b_ml.ml_line_count;
retval = readfile(NULL, NULL, (linenr_T)line_count,
(linenr_T)0, (linenr_T)MAXLNUM, eap,
flags | READ_BUFFER);
if (retval == OK)
{
/* Delete the binary lines. */
while (--line_count >= 0)
ml_delete((linenr_T)1, FALSE);
}
else
{
/* Delete the converted lines. */
while (curbuf->b_ml.ml_line_count > line_count)
ml_delete(line_count, FALSE);
}
/* Put the cursor on the first line. */
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
/* Set or reset 'modified' before executing autocommands, so that
* it can be changed there. */
if (!readonlymode && !bufempty())
changed();
else if (retval != FAIL)
unchanged(curbuf, FALSE);
#ifdef FEAT_AUTOCMD
# ifdef FEAT_EVAL
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
curbuf, &retval);
# else
apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
# endif
#endif
}
retval = read_buffer(TRUE, eap, flags);
}
/* if first time loading this buffer, init b_chartab[] */
@@ -243,7 +291,7 @@ open_buffer(
#endif
)
changed();
else if (retval != FAIL && !read_stdin)
else if (retval != FAIL && !read_stdin && !read_fifo)
unchanged(curbuf, FALSE);
save_file_ff(curbuf); /* keep this fileformat */
+1 -1
View File
@@ -3907,7 +3907,7 @@ ins_compl_prep(int c)
/* CTRL-E means completion is Ended, go back to the typed text.
* but only do this, if the Popup is still visible */
if (c == Ctrl_E && pum_visible())
if (c == Ctrl_E)
{
ins_compl_delete();
if (compl_leader != NULL)
+66
View File
@@ -396,8 +396,11 @@ static void f_tan(typval_T *argvars, typval_T *rettv);
static void f_tanh(typval_T *argvars, typval_T *rettv);
#endif
#ifdef FEAT_TIMERS
static void f_timer_info(typval_T *argvars, typval_T *rettv);
static void f_timer_pause(typval_T *argvars, typval_T *rettv);
static void f_timer_start(typval_T *argvars, typval_T *rettv);
static void f_timer_stop(typval_T *argvars, typval_T *rettv);
static void f_timer_stopall(typval_T *argvars, typval_T *rettv);
#endif
static void f_tolower(typval_T *argvars, typval_T *rettv);
static void f_toupper(typval_T *argvars, typval_T *rettv);
@@ -815,8 +818,11 @@ static struct fst
{"test_null_string", 0, 0, f_test_null_string},
{"test_settime", 1, 1, f_test_settime},
#ifdef FEAT_TIMERS
{"timer_info", 0, 1, f_timer_info},
{"timer_pause", 2, 2, f_timer_pause},
{"timer_start", 2, 3, f_timer_start},
{"timer_stop", 1, 1, f_timer_stop},
{"timer_stopall", 0, 0, f_timer_stopall},
#endif
{"tolower", 1, 1, f_tolower},
{"toupper", 1, 1, f_toupper},
@@ -4254,6 +4260,13 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
}
#endif
#ifdef FEAT_SIGNS
if (xpc.xp_context == EXPAND_SIGN)
{
set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
}
#endif
pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
@@ -11980,6 +11993,50 @@ free_callback(char_u *callback, partial_T *partial)
#endif
#ifdef FEAT_TIMERS
/*
* "timer_info([timer])" function
*/
static void
f_timer_info(typval_T *argvars, typval_T *rettv)
{
timer_T *timer = NULL;
if (rettv_list_alloc(rettv) != OK)
return;
if (argvars[0].v_type != VAR_UNKNOWN)
{
if (argvars[0].v_type != VAR_NUMBER)
EMSG(_(e_number_exp));
else
{
timer = find_timer((int)get_tv_number(&argvars[0]));
if (timer != NULL)
add_timer_info(rettv, timer);
}
}
else
add_timer_info_all(rettv);
}
/*
* "timer_pause(timer, paused)" function
*/
static void
f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED)
{
timer_T *timer = NULL;
int paused = (int)get_tv_number(&argvars[1]);
if (argvars[0].v_type != VAR_NUMBER)
EMSG(_(e_number_exp));
else
{
timer = find_timer((int)get_tv_number(&argvars[0]));
if (timer != NULL)
timer->tr_paused = paused;
}
}
/*
* "timer_start(time, callback [, options])" function
*/
@@ -12041,6 +12098,15 @@ f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED)
if (timer != NULL)
stop_timer(timer);
}
/*
* "timer_stopall()" function
*/
static void
f_timer_stopall(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
stop_all_timers();
}
#endif
/*
+90 -4
View File
@@ -1139,10 +1139,8 @@ create_timer(long msec, int repeat)
timer->tr_id = ++last_timer_id;
insert_timer(timer);
if (repeat != 0)
{
timer->tr_repeat = repeat - 1;
timer->tr_interval = msec;
}
timer->tr_interval = msec;
profile_setlimit(msec, &timer->tr_due);
return timer;
@@ -1191,6 +1189,8 @@ check_due_timer(void)
next_due = -1;
for (timer = first_timer; timer != NULL; timer = timer->tr_next)
{
if (timer->tr_paused)
continue;
# ifdef WIN3264
this_due = (long)(((double)(timer->tr_due.QuadPart - now.QuadPart)
/ (double)fr.QuadPart) * 1000);
@@ -1253,6 +1253,76 @@ stop_timer(timer_T *timer)
free_timer(timer);
}
void
stop_all_timers(void)
{
while (first_timer != NULL)
stop_timer(first_timer);
}
void
add_timer_info(typval_T *rettv, timer_T *timer)
{
list_T *list = rettv->vval.v_list;
dict_T *dict = dict_alloc();
dictitem_T *di;
long remaining;
proftime_T now;
# ifdef WIN3264
LARGE_INTEGER fr;
#endif
if (dict == NULL)
return;
list_append_dict(list, dict);
dict_add_nr_str(dict, "id", (long)timer->tr_id, NULL);
dict_add_nr_str(dict, "time", (long)timer->tr_interval, NULL);
profile_start(&now);
# ifdef WIN3264
QueryPerformanceFrequency(&fr);
remaining = (long)(((double)(timer->tr_due.QuadPart - now.QuadPart)
/ (double)fr.QuadPart) * 1000);
# else
remaining = (timer->tr_due.tv_sec - now.tv_sec) * 1000
+ (timer->tr_due.tv_usec - now.tv_usec) / 1000;
# endif
dict_add_nr_str(dict, "remaining", (long)remaining, NULL);
dict_add_nr_str(dict, "repeat",
(long)(timer->tr_repeat < 0 ? -1 : timer->tr_repeat + 1), NULL);
dict_add_nr_str(dict, "paused", (long)(timer->tr_paused), NULL);
di = dictitem_alloc((char_u *)"callback");
if (di != NULL)
{
if (dict_add(dict, di) == FAIL)
vim_free(di);
else if (timer->tr_partial != NULL)
{
di->di_tv.v_type = VAR_PARTIAL;
di->di_tv.vval.v_partial = timer->tr_partial;
++timer->tr_partial->pt_refcount;
}
else
{
di->di_tv.v_type = VAR_FUNC;
di->di_tv.vval.v_string = vim_strsave(timer->tr_callback);
}
di->di_tv.v_lock = 0;
}
}
void
add_timer_info_all(typval_T *rettv)
{
timer_T *timer;
for (timer = first_timer; timer != NULL; timer = timer->tr_next)
add_timer_info(rettv, timer);
}
/*
* Mark references in partials of timers.
*/
@@ -3313,15 +3383,30 @@ do_in_path(
rtp = rtp_copy;
while (*rtp != NUL && ((flags & DIP_ALL) || !did_one))
{
size_t buflen;
/* Copy the path from 'runtimepath' to buf[]. */
copy_option_part(&rtp, buf, MAXPATHL, ",");
buflen = STRLEN(buf);
/* Skip after or non-after directories. */
if (flags & (DIP_NOAFTER | DIP_AFTER))
{
int is_after = buflen >= 5
&& STRCMP(buf + buflen - 5, "after") == 0;
if ((is_after && (flags & DIP_NOAFTER))
|| (!is_after && (flags & DIP_AFTER)))
continue;
}
if (name == NULL)
{
(*callback)(buf, (void *) &cookie);
if (!did_one)
did_one = (cookie == NULL);
}
else if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL)
else if (buflen + STRLEN(name) + 2 < MAXPATHL)
{
add_pathsep(buf);
tail = buf + STRLEN(buf);
@@ -3585,6 +3670,7 @@ static int did_source_packages = FALSE;
/*
* ":packloadall"
* Find plugins in the package directories and source them.
* "eap" is NULL when invoked during startup.
*/
void
ex_packloadall(exarg_T *eap)
+9 -5
View File
@@ -212,6 +212,7 @@ filemess(
* stdin)
* READ_DUMMY read into a dummy buffer (to check if file contents changed)
* READ_KEEP_UNDO don't clear undo info or read it from a file
* READ_FIFO read from fifo/socket instead of a file
*
* return FAIL for failure, OK otherwise
*/
@@ -231,6 +232,7 @@ readfile(
int filtering = (flags & READ_FILTER);
int read_stdin = (flags & READ_STDIN);
int read_buffer = (flags & READ_BUFFER);
int read_fifo = (flags & READ_FIFO);
int set_options = newfile || read_buffer
|| (eap != NULL && eap->read_edit);
linenr_T read_buf_lnum = 1; /* next line to read from curbuf */
@@ -431,7 +433,7 @@ readfile(
}
}
if (!read_stdin && !read_buffer)
if (!read_stdin && !read_buffer && !read_fifo)
{
#ifdef UNIX
/*
@@ -489,7 +491,7 @@ readfile(
if (check_readonly && !readonlymode)
curbuf->b_p_ro = FALSE;
if (newfile && !read_stdin && !read_buffer)
if (newfile && !read_stdin && !read_buffer && !read_fifo)
{
/* Remember time of file. */
if (mch_stat((char *)fname, &st) >= 0)
@@ -1101,6 +1103,7 @@ retry:
* and we can't do it internally or with iconv().
*/
if (fio_flags == 0 && !read_stdin && !read_buffer && *p_ccv != NUL
&& !read_fifo
# ifdef USE_ICONV
&& iconv_fd == (iconv_t)-1
# endif
@@ -1149,7 +1152,7 @@ retry:
/* Set "can_retry" when it's possible to rewind the file and try with
* another "fenc" value. It's FALSE when no other "fenc" to try, reading
* stdin or fixed at a specific encoding. */
can_retry = (*fenc != NUL && !read_stdin && !keep_dest_enc);
can_retry = (*fenc != NUL && !read_stdin && !read_fifo && !keep_dest_enc);
#endif
if (!skip_read)
@@ -1166,6 +1169,7 @@ retry:
&& curbuf->b_ffname != NULL
&& curbuf->b_p_udf
&& !filtering
&& !read_fifo
&& !read_stdin
&& !read_buffer);
if (read_undo_file)
@@ -2666,7 +2670,7 @@ failed:
#endif
#ifdef FEAT_AUTOCMD
if (!read_stdin && !read_buffer)
if (!read_stdin && !read_fifo && (!read_buffer || sfname != NULL))
{
int m = msg_scroll;
int n = msg_scrolled;
@@ -2685,7 +2689,7 @@ failed:
if (filtering)
apply_autocmds_exarg(EVENT_FILTERREADPOST, NULL, sfname,
FALSE, curbuf, eap);
else if (newfile)
else if (newfile || (read_buffer && sfname != NULL))
{
apply_autocmds_exarg(EVENT_BUFREADPOST, NULL, sfname,
FALSE, curbuf, eap);
+1 -1
View File
@@ -447,7 +447,7 @@ gui_init_check(void)
* See gui_do_fork().
* Use a simpler check if the GUI window can probably be opened.
*/
result = gui.dofork ? gui_mch_early_init_check() : gui_mch_init_check();
result = gui.dofork ? gui_mch_early_init_check(TRUE) : gui_mch_init_check();
# else
result = gui_mch_init_check();
# endif
+1 -1
View File
@@ -16,7 +16,7 @@
# include <X11/StringDefs.h>
#endif
#ifdef FEAT_BEVAL
#if defined(FEAT_BEVAL) || defined(PROTO)
# include "gui_beval.h"
#endif
+7 -4
View File
@@ -542,8 +542,10 @@ gui_mch_prepare(int *argc, char **argv)
}
/* These arguments make gnome_program_init() print a message and exit.
* Must start the GUI for this, otherwise ":gui" will exit later! */
if (option->flags & ARG_NEEDS_GUI)
* Must start the GUI for this, otherwise ":gui" will exit later!
* Only when the GUI can start. */
if ((option->flags & ARG_NEEDS_GUI)
&& gui_mch_early_init_check(FALSE) == OK)
gui.starting = TRUE;
if (option->flags & ARG_KEEP)
@@ -1663,7 +1665,7 @@ selection_get_cb(GtkWidget *widget UNUSED,
* Return OK or FAIL.
*/
int
gui_mch_early_init_check(void)
gui_mch_early_init_check(int give_message)
{
char_u *p;
@@ -1672,7 +1674,8 @@ gui_mch_early_init_check(void)
if (p == NULL || *p == NUL)
{
gui.dying = TRUE;
EMSG(_((char *)e_opendisp));
if (give_message)
EMSG(_((char *)e_opendisp));
return FAIL;
}
return OK;
+4 -2
View File
@@ -247,6 +247,7 @@ gui_mch_set_rendering_options(char_u *s)
# define CONST
# define FAR
# define NEAR
# undef _cdecl
# define _cdecl
typedef int BOOL;
typedef int BYTE;
@@ -288,6 +289,7 @@ typedef void VOID;
typedef int LPNMHDR;
typedef int LONG;
typedef int WNDPROC;
typedef int UINT_PTR;
#endif
#ifndef GET_X_LPARAM
@@ -3451,7 +3453,7 @@ gui_mch_settitle(
set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title));
}
#ifdef FEAT_MOUSESHAPE
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
/* Table for shape IDCs. Keep in sync with the mshape_names[] table in
* misc2.c! */
static LPCSTR mshape_idcs[] =
@@ -3514,7 +3516,7 @@ mch_set_mouse_shape(int shape)
}
#endif
#ifdef FEAT_BROWSE
#if defined(FEAT_BROWSE) || defined(PROTO)
/*
* The file browser exists in two versions: with "W" uses wide characters,
* without "W" the current codepage. When FEAT_MBYTE is defined and on
+8 -5
View File
@@ -1009,8 +1009,11 @@ static intptr_t _tls_index = 0;
#endif
int
mzscheme_main(int argc, char** argv)
mzscheme_main()
{
int argc = 0;
char *argv = NULL;
#ifdef DYNAMIC_MZSCHEME
/*
* Racket requires trampolined startup. We can not load it later.
@@ -1019,16 +1022,16 @@ mzscheme_main(int argc, char** argv)
if (!mzscheme_enabled(FALSE))
{
disabled = TRUE;
return vim_main2(argc, argv);
return vim_main2();
}
#endif
#ifdef HAVE_TLS_SPACE
scheme_register_tls_space(&tls_space, _tls_index);
#endif
#ifdef TRAMPOLINED_MZVIM_STARTUP
return scheme_main_setup(TRUE, mzscheme_env_main, argc, argv);
return scheme_main_setup(TRUE, mzscheme_env_main, argc, &argv);
#else
return mzscheme_env_main(NULL, argc, argv);
return mzscheme_env_main(NULL, argc, &argv);
#endif
}
@@ -1056,7 +1059,7 @@ mzscheme_env_main(Scheme_Env *env, int argc, char **argv)
* We trampoline into vim_main2
* Passing argc, argv through from mzscheme_main
*/
vim_main_result = vim_main2(argc, argv);
vim_main_result = vim_main2();
#if !defined(TRAMPOLINED_MZVIM_STARTUP) && defined(MZ_PRECISE_GC)
/* releasing dummy */
MZ_GC_REG();
+51 -46
View File
@@ -92,6 +92,9 @@ static char_u *start_dir = NULL; /* current working dir on startup */
static int has_dash_c_arg = FALSE;
/* Various parameters passed between main() and other functions. */
static mparm_T params;
int
# ifdef VIMDLL
_export
@@ -106,9 +109,6 @@ main
# endif
(int argc, char **argv)
{
char_u *fname = NULL; /* file name from command line */
mparm_T params; /* various parameters passed between
* main() and other functions. */
#ifdef STARTUPTIME
int i;
#endif
@@ -164,6 +164,7 @@ main
#endif
#ifdef STARTUPTIME
/* Need to find "--startuptime" before actually parsing arguments. */
for (i = 1; i < argc; ++i)
{
if (STRICMP(argv[i], "--startuptime") == 0 && i + 1 < argc)
@@ -256,7 +257,7 @@ main
mch_chdir((char *)start_dir);
}
#endif
fname = alist_name(&GARGLIST[0]);
params.fname = alist_name(&GARGLIST[0]);
}
#if defined(WIN32) && defined(FEAT_MBYTE)
@@ -278,7 +279,7 @@ main
* Hint: to avoid this when typing a command use a forward slash.
* If the cd fails, it doesn't matter.
*/
(void)vim_chdirfile(fname);
(void)vim_chdirfile(params.fname);
if (start_dir != NULL)
mch_dirname(start_dir, MAXPATHL);
}
@@ -296,7 +297,7 @@ main
/*
* When listing swap file names, don't do cursor positioning et. al.
*/
if (recoverymode && fname == NULL)
if (recoverymode && params.fname == NULL)
params.want_full_screen = FALSE;
/*
@@ -328,8 +329,8 @@ main
if (getcwd((char *)NameBuff, MAXPATHL) != NULL
&& STRCMP(NameBuff, "/") == 0)
{
if (fname != NULL)
(void)vim_chdirfile(fname);
if (params.fname != NULL)
(void)vim_chdirfile(params.fname);
else
{
expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
@@ -418,43 +419,42 @@ main
debug_break_level = params.use_debug_break_level;
#endif
#ifdef FEAT_GUI_MACVIM
gui_macvim_release_autoreleasepool(autoreleasePool);
#endif
#ifdef FEAT_MZSCHEME
/*
* Newer version of MzScheme (Racket) require earlier (trampolined)
* initialisation via scheme_main_setup.
* Implement this by initialising it as early as possible
* and splitting off remaining Vim main into vim_main2
* and splitting off remaining Vim main into vim_main2().
*/
{
/* Pack up preprocessed command line arguments.
* It is safe because Scheme does not access argc/argv. */
char *args[2];
args[0] = (char *)fname;
args[1] = (char *)&params;
return mzscheme_main(2, args);
}
}
return mzscheme_main();
#else
return vim_main2();
#endif
}
#endif /* NO_VIM_MAIN */
#endif /* PROTO */
/* vim_main2() needs to be produced when FEAT_MZSCHEME is defined even when
* NO_VIM_MAIN is defined. */
#ifdef FEAT_MZSCHEME
/*
* vim_main2() is needed for FEAT_MZSCHEME, but we define it always to keep
* things simple.
* It is also defined when NO_VIM_MAIN is defined, but then it's empty.
*/
int
vim_main2(int argc UNUSED, char **argv UNUSED)
vim_main2(void)
{
# ifndef NO_VIM_MAIN
char_u *fname = (char_u *)argv[0];
mparm_T params;
memcpy(&params, argv[1], sizeof(params));
# else
return 0;
}
# endif
#endif
#ifndef NO_VIM_MAIN
#ifdef FEAT_GUI_MACVIM
void *autoreleasePool = gui_macvim_new_autoreleasepool();
#endif
/* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments.
* Allows for setting 'loadplugins' there. */
if (params.use_vimrc != NULL && STRCMP(params.use_vimrc, "NONE") == 0)
p_lpl = FALSE;
/* Execute --cmd arguments. */
exe_pre_commands(&params);
@@ -469,14 +469,22 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
if (p_lpl)
{
# ifdef VMS /* Somehow VMS doesn't handle the "**". */
source_runtime((char_u *)"plugin/*.vim", DIP_ALL);
source_runtime((char_u *)"plugin/*.vim", DIP_ALL | DIP_NOAFTER);
# else
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL);
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_NOAFTER);
# endif
TIME_MSG("loading plugins");
ex_packloadall(NULL);
TIME_MSG("loading packages");
# ifdef VMS /* Somehow VMS doesn't handle the "**". */
source_runtime((char_u *)"plugin/*.vim", DIP_ALL | DIP_AFTER);
# else
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL | DIP_AFTER);
# endif
TIME_MSG("loading after plugins");
}
#endif
@@ -496,7 +504,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
* This uses the 'dir' option, therefore it must be after the
* initializations.
*/
if (recoverymode && fname == NULL)
if (recoverymode && params.fname == NULL)
{
recover_names(NULL, TRUE, 0, NULL);
mch_exit(0);
@@ -931,17 +939,16 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
#ifdef FEAT_GUI_MACVIM
gui_macvim_release_autoreleasepool(autoreleasePool);
#endif
#endif /* NO_VIM_MAIN */
return 0;
}
#endif /* NO_VIM_MAIN */
#endif /* PROTO */
/*
* Initialisation shared by main() and some tests.
*/
void
common_init(mparm_T *params)
common_init(mparm_T *paramp)
{
#ifdef FEAT_MBYTE
@@ -958,7 +965,7 @@ common_init(mparm_T *params)
#ifdef MAC_OS_CLASSIC
/* Prepare for possibly starting GUI sometime */
/* Macintosh needs this before any memory is allocated. */
gui_prepare(&params->argc, params->argv);
gui_prepare(&paramp->argc, paramp->argv);
TIME_MSG("GUI prepared");
#endif
@@ -1007,14 +1014,14 @@ common_init(mparm_T *params)
* --socketid
* --windowid
*/
early_arg_scan(params);
early_arg_scan(paramp);
#ifdef FEAT_SUN_WORKSHOP
findYourself(params->argv[0]);
findYourself(paramp->argv[0]);
#endif
#if defined(FEAT_GUI) && !defined(MAC_OS_CLASSIC)
/* Prepare for possibly starting GUI sometime */
gui_prepare(&params->argc, params->argv);
gui_prepare(&paramp->argc, paramp->argv);
TIME_MSG("GUI prepared");
#endif
@@ -1029,7 +1036,7 @@ common_init(mparm_T *params)
* (needed for :! to * work). mch_check_win() will also handle the -d or
* -dev argument.
*/
params->stdout_isatty = (mch_check_win(params->argc, params->argv) != FAIL);
paramp->stdout_isatty = (mch_check_win(paramp->argc, paramp->argv) != FAIL);
TIME_MSG("window checked");
/*
@@ -3023,8 +3030,6 @@ source_startup_scripts(mparm_T *parmp)
if (use_gvimrc == NULL) /* don't load gvimrc either */
use_gvimrc = parmp->use_vimrc;
#endif
if (parmp->use_vimrc[2] == 'N')
p_lpl = FALSE; /* don't load plugins either */
}
else
{
+1 -1
View File
@@ -6283,7 +6283,7 @@ write_viminfo_registers(FILE *fp)
* 'permanent' of the two), otherwise the PRIMARY one.
* For now, use a hard-coded sanity limit of 1Mb of data.
*/
#if defined(FEAT_X11) && defined(FEAT_CLIPBOARD)
#if (defined(FEAT_X11) && defined(FEAT_CLIPBOARD)) || defined(PROTO)
void
x11_export_final_selection(void)
{
+22 -4
View File
@@ -4995,12 +4995,30 @@ do_set(
{
/* Remove flags that appear twice. */
for (s = newval; *s; ++s)
if ((!(flags & P_COMMA) || *s != ',')
&& vim_strchr(s + 1, *s) != NULL)
{
/* if options have P_FLAGLIST and
* P_ONECOMMA such as 'whichwrap' */
if (flags & P_ONECOMMA)
{
STRMOVE(s, s + 1);
--s;
if (*s != ',' && *(s + 1) == ','
&& vim_strchr(s + 2, *s) != NULL)
{
/* Remove the duplicated value and
* the next comma. */
STRMOVE(s, s + 2);
s -= 2;
}
}
else
{
if ((!(flags & P_COMMA) || *s != ',')
&& vim_strchr(s + 1, *s) != NULL)
{
STRMOVE(s, s + 1);
--s;
}
}
}
}
if (save_arg != NULL) /* number for 'whichwrap' */
+3
View File
@@ -22,6 +22,9 @@ timer_T *create_timer(long msec, int repeat);
long check_due_timer(void);
timer_T *find_timer(int id);
void stop_timer(timer_T *timer);
void stop_all_timers(void);
void add_timer_info(typval_T *rettv, timer_T *timer);
void add_timer_info_all(typval_T *rettv);
int set_ref_in_timer(int copyID);
void timer_free_all(void);
void profile_divide(proftime_T *tm, int count, proftime_T *tm2);
+1 -1
View File
@@ -33,7 +33,7 @@ void free_all_autocmds(void);
int check_ei(void);
char_u *au_event_disable(char *what);
void au_event_restore(char_u *old_ei);
void do_autocmd(char_u *arg, int forceit);
void do_autocmd(char_u *arg_in, int forceit);
int do_doautocmd(char_u *arg, int do_msg, int *did_something);
void ex_doautoall(exarg_T *eap);
int check_nomodeline(char_u **argp);
+1 -1
View File
@@ -6,7 +6,7 @@ int gui_mch_is_blink_off(void);
void gui_mch_set_blinking(long waittime, long on, long off);
void gui_mch_stop_blink(void);
void gui_mch_start_blink(void);
int gui_mch_early_init_check(void);
int gui_mch_early_init_check(int give_message);
int gui_mch_init_check(void);
void gui_mch_show_tabline(int showit);
int gui_mch_showing_tabline(void);
+1 -1
View File
@@ -3,7 +3,7 @@ int mzscheme_enabled(int verbose);
void mzvim_check_threads(void);
void mzvim_reset_timer(void);
void mzscheme_end(void);
int mzscheme_main(int argc, char **argv);
int mzscheme_main(void);
void mzscheme_buffer_free(buf_T *buf);
void mzscheme_window_free(win_T *win);
void ex_mzscheme(exarg_T *eap);
+2 -1
View File
@@ -1,5 +1,6 @@
/* main.c */
void common_init(mparm_T *params);
int vim_main2(void);
void common_init(mparm_T *paramp);
void main_loop(int cmdwin, int noexmode);
void getout_preserve_modified(int exitval);
void getout(int exitval);
+1 -1
View File
@@ -4,7 +4,7 @@ int verb_msg(char_u *s);
int msg_attr(char_u *s, int attr);
int msg_attr_keep(char_u *s, int attr, int keep);
char_u *msg_strtrunc(char_u *s, int force);
void trunc_string(char_u *s, char_u *buf, int room, int buflen);
void trunc_string(char_u *s, char_u *buf, int room_in, int buflen);
void reset_last_sourcing(void);
void msg_source(int attr);
int emsg_not_now(void);
+1 -1
View File
@@ -16,7 +16,7 @@ void push_showcmd(void);
void pop_showcmd(void);
void do_check_scrollbind(int check);
void check_scrollbind(linenr_T topline_diff, long leftcol_diff);
int find_decl(char_u *ptr, int len, int locally, int thisblock, int searchflags);
int find_decl(char_u *ptr, int len, int locally, int thisblock, int flags_arg);
void scroll_redraw(int up, long count);
void handle_tabmenu(void);
void do_nv_ident(int c1, int c2);
+1 -1
View File
@@ -47,7 +47,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, int g_cmd);
void prepare_viminfo_registers(void);
void finish_viminfo_registers(void);
int read_viminfo_register(vir_T *virp, int force);
void handle_viminfo_register(garray_T *values, int writing);
void handle_viminfo_register(garray_T *values, int force);
void write_viminfo_registers(FILE *fp);
void x11_export_final_selection(void);
void clip_free_selection(VimClipboard *cbd);
+4 -1
View File
@@ -3178,8 +3178,9 @@ struct timer_S
timer_T *tr_next;
timer_T *tr_prev;
proftime_T tr_due; /* when the callback is to be invoked */
int tr_paused; /* when TRUE callback is not invoked */
int tr_repeat; /* number of times to repeat, -1 forever */
long tr_interval; /* only set when it repeats */
long tr_interval; /* msec */
char_u *tr_callback; /* allocated */
partial_T *tr_partial;
#endif
@@ -3199,6 +3200,8 @@ typedef struct
int argc;
char **argv;
char_u *fname; /* first file to edit */
int evim_mode; /* started as "evim" */
char_u *use_vimrc; /* vimrc from -u argument */
+1
View File
@@ -6110,6 +6110,7 @@ gui_get_color_cmn(char_u *name)
{(char_u *)"gray", RGB(0xBE, 0xBE, 0xBE)},
{(char_u *)"green", RGB(0x00, 0xFF, 0x00)},
{(char_u *)"grey", RGB(0xBE, 0xBE, 0xBE)},
{(char_u *)"grey40", RGB(0x66, 0x66, 0x66)},
{(char_u *)"grey90", RGB(0xE5, 0xE5, 0xE5)},
{(char_u *)"lightblue", RGB(0xAD, 0xD8, 0xE6)},
{(char_u *)"lightcyan", RGB(0xE0, 0xFF, 0xFF)},
+2 -3
View File
@@ -51,7 +51,6 @@ SCRIPTS_ALL = \
test57.out \
test60.out \
test62.out \
test63.out \
test64.out \
test65.out \
test66.out \
@@ -102,9 +101,7 @@ SCRIPTS_ALL = \
test_mapping.out \
test_marks.out \
test_nested_function.out \
test_options.out \
test_search_mbyte.out \
test_signs.out \
test_tagcase.out \
test_utf8.out \
test_wordcount.out \
@@ -186,7 +183,9 @@ NEW_TESTS = test_arglist.res \
test_perl.res \
test_quickfix.res \
test_ruby.res \
test_signs.res \
test_startup.res \
test_startup_utf8.res \
test_stat.res \
test_syntax.res \
test_textobjects.res \
+2
View File
@@ -114,4 +114,6 @@ bench_re_freeze.out: bench_re_freeze.vim
newtests: $(NEW_TESTS)
.vim.res:
@echo "$(VIMPROG)" > vimcmd
$(VIMPROG) -u NONE $(NO_PLUGIN) -S runtest.vim $*.vim
@del vimcmd
+7 -5
View File
@@ -48,21 +48,21 @@ $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST)
.SUFFIXES: .in .out .res .vim
vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) newtests
echo ALL DONE
@echo ALL DONE
nongui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests
echo ALL DONE
@echo ALL DONE
benchmark: $(SCRIPTS_BENCH)
small: nolog
echo ALL DONE
@echo ALL DONE
gui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests
echo ALL DONE
@echo ALL DONE
win32: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests
echo ALL DONE
@echo ALL DONE
# TODO: find a way to avoid changing the distributed files.
fixff:
@@ -117,5 +117,7 @@ bench_re_freeze.out: bench_re_freeze.vim
newtests: $(NEW_TESTS)
.vim.res:
@echo "$(VIMPROG)" > vimcmd
$(VIMPROG) -u NONE $(NO_PLUGIN) -S runtest.vim $*.vim
@$(DEL) vimcmd
+3 -1
View File
@@ -127,4 +127,6 @@ newtestssilent: $(NEW_TESTS)
.vim.res:
$(RUN_VIMTEST) -u NONE -U NONE -S runtest.vim $*.vim
@echo "$(RUN_VIMTEST)" > vimcmd
$(RUN_VIMTEST) -U NONE -S runtest.vim $*.vim
@rm vimcmd
+4 -1
View File
@@ -1,7 +1,10 @@
" Common preparations for running tests.
" Make sure 'runtimepath' does not include $HOME.
" Make sure 'runtimepath' and 'packpath' does not include $HOME.
set rtp=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after
if has('packages')
let &packpath = &rtp
endif
" Only when the +eval feature is present.
if 1
+49 -1
View File
@@ -109,14 +109,62 @@ func s:kill_server(cmd)
endfunc
" Wait for up to a second for "expr" to become true.
" Return time slept in milliseconds.
func WaitFor(expr)
let slept = 0
for i in range(100)
try
if eval(a:expr)
return
return slept
endif
catch
endtry
let slept += 10
sleep 10m
endfor
endfunc
" Run Vim, using the "vimcmd" file and "-u NORC".
" "before" is a list of Vim commands to be executed before loading plugins.
" "after" is a list of Vim commands to be executed after loading plugins.
" Plugins are not loaded, unless 'loadplugins' is set in "before".
" Return 1 if Vim could be executed.
func RunVim(before, after, arguments)
return RunVimPiped(a:before, a:after, a:arguments, '')
endfunc
func RunVimPiped(before, after, arguments, pipecmd)
if !filereadable('vimcmd')
return 0
endif
let args = ''
if len(a:before) > 0
call writefile(a:before, 'Xbefore.vim')
let args .= ' --cmd "so Xbefore.vim"'
endif
if len(a:after) > 0
call writefile(a:after, 'Xafter.vim')
let args .= ' -S Xafter.vim'
endif
let cmd = readfile('vimcmd')[0]
let cmd = substitute(cmd, '-u \f\+', '-u NONE', '')
if cmd !~ '-u NONE'
let cmd = cmd . ' -u NONE'
endif
" With pipecmd we can't set VIMRUNTIME.
if a:pipecmd != ''
let cmd = substitute(cmd, 'VIMRUNTIME=.*VIMRUNTIME;', '', '')
endif
exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments
if len(a:before) > 0
call delete('Xbefore.vim')
endif
if len(a:after) > 0
call delete('Xafter.vim')
endif
return 1
endfunc
-200
View File
@@ -1,200 +0,0 @@
Test for ":match", ":2match", ":3match", "clearmatches()", "getmatches()",
"matchadd()", "matchaddpos", "matcharg()", "matchdelete()", and "setmatches()".
STARTTEST
:so small.vim
:set encoding=utf8
:" --- Check that "matcharg()" returns the correct group and pattern if a match
:" --- is defined.
:let @r = "*** Test 1: "
:highlight MyGroup1 term=bold ctermbg=red guibg=red
:highlight MyGroup2 term=italic ctermbg=green guibg=green
:highlight MyGroup3 term=underline ctermbg=blue guibg=blue
:match MyGroup1 /TODO/
:2match MyGroup2 /FIXME/
:3match MyGroup3 /XXX/
:if matcharg(1) == ['MyGroup1', 'TODO'] && matcharg(2) == ['MyGroup2', 'FIXME'] && matcharg(3) == ['MyGroup3', 'XXX']
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:" --- Check that "matcharg()" returns an empty list if the argument is not 1,
:" --- 2 or 3 (only 0 and 4 are tested).
:let @r .= "*** Test 2: "
:if matcharg(0) == [] && matcharg(4) == []
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:" --- Check that "matcharg()" returns ['', ''] if a match is not defined.
:let @r .= "*** Test 3: "
:match
:2match
:3match
:if matcharg(1) == ['', ''] && matcharg(2) == ['', ''] && matcharg(3) == ['', '']
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:" --- Check that "matchadd()" and "getmatches()" agree on added matches and
:" --- that default values apply.
:let @r .= "*** Test 4: "
:let m1 = matchadd("MyGroup1", "TODO")
:let m2 = matchadd("MyGroup2", "FIXME", 42)
:let m3 = matchadd("MyGroup3", "XXX", 60, 17)
:if getmatches() == [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 4}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 42, 'id': 5}, {'group': 'MyGroup3', 'pattern': 'XXX', 'priority': 60, 'id': 17}]
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:" --- Check that "matchdelete()" deletes the matches defined in the previous
:" --- test correctly.
:let @r .= "*** Test 5: "
:call matchdelete(m1)
:call matchdelete(m2)
:call matchdelete(m3)
:unlet m1
:unlet m2
:unlet m3
:if getmatches() == []
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:" --- Check that "matchdelete()" returns 0 if successful and otherwise -1.
:let @r .= "*** Test 6: "
:let m = matchadd("MyGroup1", "TODO")
:let r1 = matchdelete(m)
:let r2 = matchdelete(42)
:if r1 == 0 && r2 == -1
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:unlet m
:unlet r1
:unlet r2
:" --- Check that "clearmatches()" clears all matches defined by ":match" and
:" --- "matchadd()".
:let @r .= "*** Test 7: "
:let m1 = matchadd("MyGroup1", "TODO")
:let m2 = matchadd("MyGroup2", "FIXME", 42)
:let m3 = matchadd("MyGroup3", "XXX", 60, 17)
:match MyGroup1 /COFFEE/
:2match MyGroup2 /HUMPPA/
:3match MyGroup3 /VIM/
:call clearmatches()
:if getmatches() == []
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:unlet m1
:unlet m2
:unlet m3
:" --- Check that "setmatches()" restores a list of matches saved by
:" --- "getmatches()" without changes. (Matches with equal priority must also
:" --- remain in the same order.)
:let @r .= "*** Test 8: "
:let m1 = matchadd("MyGroup1", "TODO")
:let m2 = matchadd("MyGroup2", "FIXME", 42)
:let m3 = matchadd("MyGroup3", "XXX", 60, 17)
:match MyGroup1 /COFFEE/
:2match MyGroup2 /HUMPPA/
:3match MyGroup3 /VIM/
:let ml = getmatches()
:call clearmatches()
:call setmatches(ml)
:if getmatches() == ml
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:call clearmatches()
:unlet m1
:unlet m2
:unlet m3
:unlet ml
:" --- Check that "setmatches()" will not add two matches with the same ID. The
:" --- expected behaviour (for now) is to add the first match but not the
:" --- second and to return 0 (even though it is a matter of debate whether
:" --- this can be considered successful behaviour).
:let @r .= "*** Test 9: "
:let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])
:if getmatches() == [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}] && r1 == 0
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:call clearmatches()
:unlet r1
:" --- Check that "setmatches()" returns 0 if successful and otherwise -1.
:" --- (A range of valid and invalid input values are tried out to generate the
:" --- return values.)
:let @r .= "*** Test 10: "
:let rs1 = setmatches([])
:let rs2 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}])
:call clearmatches()
:let rf1 = setmatches(0)
:let rf2 = setmatches([0])
:let rf3 = setmatches([{'wrong key': 'wrong value'}])
:if rs1 == 0 && rs2 == 0 && rf1 == -1 && rf2 == -1 && rf3 == -1
: let @r .= "OK\n"
:else
: let @r .= "FAILED\n"
:endif
:unlet rs1
:unlet rs2
:unlet rf1
:unlet rf2
:unlet rf3
:" --- Check that "matchaddpos()" positions matches correctly
:let @r .= "*** Test 11:\n"
:set nolazyredraw
:call setline(1, 'abcdefghijklmnopq')
:call matchaddpos("MyGroup1", [[1, 5], [1, 8, 3]], 10, 3)
:1
:redraw!
:let v1 = screenattr(1, 1)
:let v5 = screenattr(1, 5)
:let v6 = screenattr(1, 6)
:let v8 = screenattr(1, 8)
:let v10 = screenattr(1, 10)
:let v11 = screenattr(1, 11)
:let @r .= string(getmatches())."\n"
:if v1 != v5 && v6 == v1 && v8 == v5 && v10 == v5 && v11 == v1
: let @r .= "OK\n"
:else
: let @r .= "FAILED: " . v5 . "/" . v6 . "/" . v8 . "/" . v10 . "/" . v11 . "\n"
:endif
:call clearmatches()
:"
:call setline(1, 'abcdΣabcdef')
:call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]])
:1
:redraw!
:let v1 = screenattr(1, 1)
:let v4 = screenattr(1, 4)
:let v5 = screenattr(1, 5)
:let v6 = screenattr(1, 6)
:let v7 = screenattr(1, 7)
:let v8 = screenattr(1, 8)
:let v9 = screenattr(1, 9)
:let v10 = screenattr(1, 10)
:let @r .= string(getmatches())."\n"
:if v1 != v4 && v5 == v4 && v6 == v1 && v7 == v1 && v8 == v4 && v9 == v4 && v10 == v1
: let @r .= "OK\n"
:else
: let @r .= "FAILED: " . v4 . "/" . v5 . "/" . v6 . "/" . v7 . "/" . v8 . "/" . v9 . "/" . v10 . "\n"
:endif
:" Check, that setmatches() can correctly restore the matches from matchaddpos()
:call matchadd('MyGroup1', '\%2lmatchadd')
:let m=getmatches()
:call clearmatches()
:call setmatches(m)
:let @r .= string(getmatches())."\n"
G"rp
:/^Results/,$wq! test.out
ENDTEST
Results of test63:
-17
View File
@@ -1,17 +0,0 @@
Results of test63:
*** Test 1: OK
*** Test 2: OK
*** Test 3: OK
*** Test 4: OK
*** Test 5: OK
*** Test 6: OK
*** Test 7: OK
*** Test 8: OK
*** Test 9: OK
*** Test 10: OK
*** Test 11:
[{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}]
OK
[{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}]
OK
[{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}, {'group': 'MyGroup1', 'pattern': '\%2lmatchadd', 'priority': 10, 'id': 12}]
+2 -1
View File
@@ -21,7 +21,7 @@ source test_join.vim
source test_jumps.vim
source test_lambda.vim
source test_lispwords.vim
source test_matchstrpos.vim
source test_match.vim
source test_menu.vim
source test_messages.vim
source test_partial.vim
@@ -38,3 +38,4 @@ source test_timers.vim
source test_true_false.vim
source test_unlet.vim
source test_window_cmd.vim
source test_options.vim
+2 -2
View File
@@ -16,7 +16,7 @@ if has('timers')
let g:triggered = 0
au CursorHoldI * let g:triggered += 1
set updatetime=20
call timer_start(100, 'ExitInsertMode')
call timer_start(200, 'ExitInsertMode')
call feedkeys('a', 'x!')
call assert_equal(1, g:triggered)
au! CursorHoldI
@@ -26,7 +26,7 @@ if has('timers')
let g:triggered = 0
au CursorHoldI * let g:triggered += 1
set updatetime=20
call timer_start(100, 'ExitInsertMode')
call timer_start(200, 'ExitInsertMode')
" CursorHoldI does not trigger after CTRL-X
call feedkeys("a\<C-X>", 'x!')
call assert_equal(0, g:triggered)
+13 -3
View File
@@ -138,6 +138,19 @@ func Test_getcompletion()
call assert_equal(keys, l)
endif
if has('signs')
sign define Testing linehl=Comment
let l = getcompletion('', 'sign')
let cmds = ['define', 'jump', 'list', 'place', 'undefine', 'unplace']
call assert_equal(cmds, l)
" using cmdline completion must not change the result
call feedkeys(":sign list \<c-d>\<c-c>", 'xt')
let l = getcompletion('', 'sign')
call assert_equal(cmds, l)
let l = getcompletion('list ', 'sign')
call assert_equal(['Testing'], l)
endif
" For others test if the name is recognized.
let names = ['buffer', 'environment', 'file_in_path',
\ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user']
@@ -150,9 +163,6 @@ func Test_getcompletion()
if has('profile')
call add(names, 'syntime')
endif
if has('signs')
call add(names, 'sign')
endif
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", "word\tfile\tcmd"], 'Xtags')
+256 -149
View File
@@ -4,6 +4,256 @@ if !has('cscope') || !executable('cscope') || !has('quickfix')
finish
endif
func CscopeSetupOrClean(setup)
if a:setup
noa sp ../memfile_test.c
saveas! Xmemfile_test.c
call system('cscope -bk -fXcscope.out Xmemfile_test.c')
call system('cscope -bk -fXcscope2.out Xmemfile_test.c')
cscope add Xcscope.out
set cscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-,a-
else
cscope kill -1
for file in ['Xcscope.out', 'Xcscope2.out', 'Xmemfile_test.c']
call delete(file)
endfo
endif
endfunc
func Test_cscopeWithCscopeConnections()
call CscopeSetupOrClean(1)
" Test 0: E568: duplicate cscope database not added
try
set nocscopeverbose
cscope add Xcscope.out
set cscopeverbose
catch
call assert_true(0)
endtry
call assert_fails('cscope add', 'E560')
call assert_fails('cscope add Xcscope.out', 'E568')
call assert_fails('cscope add doesnotexist.out', 'E563')
" Test 1: Find this C-Symbol
for cmd in ['cs find s main', 'cs find 0 main']
let a=execute(cmd)
" Test 1.1 test where it moves the cursor
call assert_equal('main(void)', getline('.'))
" Test 1.2 test the output of the :cs command
call assert_match('\n(1 of 1): <<main>> main(void )', a)
endfor
" Test 2: Find this definition
for cmd in ['cs find g test_mf_hash', 'cs find 1 test_mf_hash']
exe cmd
call assert_equal(['', '/*', ' * Test mf_hash_*() functions.', ' */', ' static void', 'test_mf_hash(void)', '{'], getline(line('.')-5, line('.')+1))
endfor
" Test 3: Find functions called by this function
for cmd in ['cs find d test_mf_hash', 'cs find 2 test_mf_hash']
let a=execute(cmd)
call assert_match('\n(1 of 42): <<mf_hash_init>> mf_hash_init(&ht);', a)
call assert_equal(' mf_hash_init(&ht);', getline('.'))
endfor
" Test 4: Find functions calling this function
for cmd in ['cs find c test_mf_hash', 'cs find 3 test_mf_hash']
let a=execute(cmd)
call assert_match('\n(1 of 1): <<main>> test_mf_hash();', a)
call assert_equal(' test_mf_hash();', getline('.'))
endfor
" Test 5: Find this text string
for cmd in ['cs find t Bram', 'cs find 4 Bram']
let a=execute(cmd)
call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
endfor
" Test 6: Find this egrep pattern
" test all matches returned by cscope
for cmd in ['cs find e ^\#includ.', 'cs find 6 ^\#includ.']
let a=execute(cmd)
call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
call assert_equal('#include <assert.h>', getline('.'))
cnext
call assert_equal('#include "main.c"', getline('.'))
cnext
call assert_equal('#include "memfile.c"', getline('.'))
call assert_fails('cnext', 'E553:')
endfor
" Test 7: Find the same egrep pattern using lcscope this time.
let a=execute('lcs find e ^\#includ.')
call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
call assert_equal('#include <assert.h>', getline('.'))
lnext
call assert_equal('#include "main.c"', getline('.'))
lnext
call assert_equal('#include "memfile.c"', getline('.'))
call assert_fails('lnext', 'E553:')
" Test 8: Find this file
for cmd in ['cs find f Xmemfile_test.c', 'cs find 7 Xmemfile_test.c']
enew
let a=execute(cmd)
call assert_match('\n"Xmemfile_test.c" 143L, 3137C', a)
call assert_equal('Xmemfile_test.c', @%)
endfor
" Test 9: Find files #including this file
for cmd in ['cs find i assert.h', 'cs find 8 assert.h']
enew
let a=execute(cmd)
call assert_equal(['','"Xmemfile_test.c" 143L, 3137C','(1 of 1): <<global>> #include <assert.h>'], split(a, '\n', 1))
call assert_equal('#include <assert.h>', getline('.'))
endfor
" Test 10: Invalid find command
call assert_fails('cs find x', 'E560:')
" Test 11: Find places where this symbol is assigned a value
" this needs a cscope >= 15.8
" unfortunately, Travis has cscope version 15.7
let cscope_version=systemlist('cscope --version')[0]
let cs_version=str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?'))
if cs_version >= 15.8
for cmd in ['cs find a item', 'cs find 9 item']
let a=execute(cmd)
call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = (mf_hashitem_T *)lalloc_clear(sizeof(mf_hashtab_T), FALSE);'], split(a, '\n', 1))
call assert_equal(' item = (mf_hashitem_T *)lalloc_clear(sizeof(mf_hashtab_T), FALSE);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
endfor
endif
" Test 12: leading whitespace is not removed for cscope find text
let a=execute('cscope find t test_mf_hash')
call assert_equal(['', '(1 of 1): <<<unknown>>> test_mf_hash();'], split(a, '\n', 1))
call assert_equal(' test_mf_hash();', getline('.'))
" Test 13: test with scscope
let a=execute('scs find t Bram')
call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
" Test 14: cscope help
for cmd in ['cs', 'cs help', 'cs xxx']
let a=execute(cmd)
call assert_match('^cscope commands:\n', a)
call assert_match('\nadd :', a)
call assert_match('\nfind :', a)
call assert_match('\nhelp : Show this message', a)
call assert_match('\nkill : Kill a connection', a)
call assert_match('\nreset: Reinit all connections', a)
call assert_match('\nshow : Show connections', a)
endfor
let a=execute('scscope help')
call assert_match('This cscope command does not support splitting the window\.', a)
" Test 15: reset connections
let a=execute('cscope reset')
call assert_match('\nAdded cscope database.*Xcscope.out (#0)', a)
call assert_match('\nAll cscope databases reset', a)
" Test 16: cscope show
let a=execute('cscope show')
call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
" Test 17: cstag and 'csto' option
set csto=0
let a=execute('cstag TEST_COUNT')
call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
call assert_equal('#define TEST_COUNT 50000', getline('.'))
set csto=1
let a=execute('cstag index_to_key')
call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
call assert_equal('#define index_to_key(i) ((i) ^ 15167)', getline('.'))
call assert_fails('cstag xxx', 'E257:')
call assert_fails('cstag', 'E562:')
" Test 18: 'cst' option
set nocst
call assert_fails('tag TEST_COUNT', 'E426:')
set cst
let a=execute('tag TEST_COUNT')
call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
call assert_equal('#define TEST_COUNT 50000', getline('.'))
let a=execute('tags')
call assert_match('1 1 TEST_COUNT\s\+\d\+\s\+#define index_to_key', a)
" Test 19: this should trigger call to cs_print_tags()
" Unclear how to check result though, we just exercise the code.
set cst cscopequickfix=s0
call feedkeys(":cs find s main\<CR>", 't')
" Test 20: cscope kill
call assert_fails('cscope kill 2', 'E261:')
call assert_fails('cscope kill xxx', 'E261:')
let a=execute('cscope kill 0')
call assert_match('cscope connection 0 closed', a)
cscope add Xcscope.out
let a=execute('cscope kill Xcscope.out')
call assert_match('cscope connection Xcscope.out closed', a)
cscope add Xcscope.out .
let a=execute('cscope kill -1')
call assert_match('cscope connection .*Xcscope.out closed', a)
let a=execute('cscope kill -1')
call assert_equal('', a)
" Test 21: 'csprg' option
call assert_equal('cscope', &csprg)
set csprg=doesnotexist
call assert_fails('cscope add Xcscope2.out', 'E609:')
set csprg=cscope
" Test 22: multiple cscope connections
cscope add Xcscope.out
cscope add Xcscope2.out . -C
let a=execute('cscope show')
call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
call assert_match('\n 1 \d\+.*Xcscope2.out\s*\.', a)
" Test 23: test Ex command line completion
call feedkeys(":cs \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"cs add find help kill reset show', @:)
call feedkeys(":scs \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"scs find', @:)
call feedkeys(":cs find \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"cs find a c d e f g i s t', @:)
call feedkeys(":cs kill \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"cs kill -1 0 1', @:)
call feedkeys(":cs add Xcscope\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"cs add Xcscope.out Xcscope2.out', @:)
" Test 24: cscope_connection()
call assert_equal(cscope_connection(), 1)
call assert_equal(cscope_connection(0, 'out'), 1)
call assert_equal(cscope_connection(0, 'xxx'), 1)
call assert_equal(cscope_connection(1, 'out'), 1)
call assert_equal(cscope_connection(1, 'xxx'), 0)
call assert_equal(cscope_connection(2, 'out'), 0)
call assert_equal(cscope_connection(3, 'xxx', '..'), 0)
call assert_equal(cscope_connection(3, 'out', 'xxx'), 0)
call assert_equal(cscope_connection(3, 'out', '.'), 1)
call assert_equal(cscope_connection(4, 'out', '.'), 0)
" CleanUp
call CscopeSetupOrClean(0)
endfunc
func Test_cscopequickfix()
set cscopequickfix=s-,g-,d+,c-,t+,e-,f0,i-,a-
call assert_equal('s-,g-,d+,c-,t+,e-,f0,i-,a-', &cscopequickfix)
@@ -14,156 +264,13 @@ func Test_cscopequickfix()
call assert_fails('set cscopequickfix=s-a', 'E474:')
endfunc
func CscopeSetupOrClean(setup)
if a:setup
noa sp ../memfile_test.c
saveas! Xmemfile_test.c
call system('cscope -bk -fXcscope.out Xmemfile_test.c')
cscope add Xcscope.out
set cscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-,a-
else
cscope kill -1
for file in ['Xcscope.out', 'Xmemfile_test.c']
call delete(file)
endfor
endif
func Test_withoutCscopeConnection()
call assert_equal(cscope_connection(), 0)
call assert_fails('cscope find s main', 'E567:')
let a=execute('cscope show')
call assert_match('no cscope connections', a)
endfunc
func Test_cscope1()
call CscopeSetupOrClean(1)
" Test 0: E568: duplicate cscope database not added
try
set nocscopeverbose
cscope add Xcscope.out
set cscopeverbose
catch
call assert_true(0)
endtry
call assert_fails('cscope add Xcscope.out', 'E568')
call assert_fails('cscope add doesnotexist.out', 'E563')
call assert_fails('cscope kill 2', 'E261')
" Test 1: Find this C-Symbol
let a=execute('cscope find s main')
" Test 1.1 test where it moves the cursor
call assert_equal('main(void)', getline('.'))
" Test 1.2 test the output of the :cs command
call assert_match('\n(1 of 1): <<main>> main(void )', a)
" Test 2: Find this definition
cscope find g test_mf_hash
call assert_equal(['', '/*', ' * Test mf_hash_*() functions.', ' */', ' static void', 'test_mf_hash(void)', '{'], getline(line('.')-5, line('.')+1))
" Test 3: Find functions called by this function
let a=execute('cscope find d test_mf_hash')
call assert_match('\n(1 of 42): <<mf_hash_init>> mf_hash_init(&ht);', a)
call assert_equal(' mf_hash_init(&ht);', getline('.'))
" Test 4: Find functions calling this function
let a=execute('cscope find c test_mf_hash')
call assert_match('\n(1 of 1): <<main>> test_mf_hash();', a)
call assert_equal(' test_mf_hash();', getline('.'))
" Test 5: Find this text string
let a=execute('cscope find t Bram')
call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
" Test 6: Find this egrep pattern
" test all matches returned by cscope
let a=execute('cscope find e ^\#includ.')
call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
call assert_equal('#include <assert.h>', getline('.'))
cnext
call assert_equal('#include "main.c"', getline('.'))
cnext
call assert_equal('#include "memfile.c"', getline('.'))
call assert_fails('cnext', 'E553')
" Test 7: Find this file
enew
let a=execute('cscope find f Xmemfile_test.c')
call assert_match('\n"Xmemfile_test.c" 143L, 3137C', a)
call assert_equal('Xmemfile_test.c', @%)
" Test 8: Find files #including this file
enew
let a=execute('cscope find i assert.h')
call assert_equal(['','"Xmemfile_test.c" 143L, 3137C','(1 of 1): <<global>> #include <assert.h>'], split(a, '\n', 1))
call assert_equal('#include <assert.h>', getline('.'))
" Test 9: Invalid find command
call assert_fails('cs find x', 'E560')
" Test 10: Find places where this symbol is assigned a value
" this needs a cscope >= 15.8
" unfortunately, Travis has cscope version 15.7
let cscope_version=systemlist('cscope --version')[0]
let cs_version=str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?'))
if cs_version >= 15.8
let a=execute('cscope find a item')
call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = (mf_hashitem_T *)lalloc_clear(sizeof(mf_hashtab_T), FALSE);'], split(a, '\n', 1))
call assert_equal(' item = (mf_hashitem_T *)lalloc_clear(sizeof(mf_hashtab_T), FALSE);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
cnext
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
endif
" Test 11: leading whitespace is not removed for cscope find text
let a=execute('cscope find t test_mf_hash')
call assert_equal(['', '(1 of 1): <<<unknown>>> test_mf_hash();'], split(a, '\n', 1))
call assert_equal(' test_mf_hash();', getline('.'))
" Test 12: cscope help
let a=execute('cscope help')
call assert_match('^cscope commands:\n', a)
call assert_match('\nadd :', a)
call assert_match('\nfind :', a)
call assert_match('\nhelp : Show this message', a)
call assert_match('\nkill : Kill a connection', a)
call assert_match('\nreset: Reinit all connections', a)
call assert_match('\nshow : Show connections', a)
" Test 13: reset connections
let a=execute('cscope reset')
call assert_match('\nAdded cscope database.*Xcscope.out (#0)', a)
call assert_match('\nAll cscope databases reset', a)
" Test 14: cscope show
let a=execute('cscope show')
call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
" Test 15: cstag and 'csto' option
set csto=0
let a=execute('cstag TEST_COUNT')
call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
call assert_equal('#define TEST_COUNT 50000', getline('.'))
set csto=1
let a=execute('cstag index_to_key')
call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
call assert_equal('#define index_to_key(i) ((i) ^ 15167)', getline('.'))
call assert_fails('cstag xxx', 'E257')
call assert_fails('cstag', 'E562')
" Test 15: 'csprg' option
call assert_equal('cscope', &csprg)
" Test 16: 'cst' option
set cst
let a=execute('tag TEST_COUNT')
call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
call assert_equal('#define TEST_COUNT 50000', getline('.'))
set nocst
call assert_fails('tag TEST_COUNT', 'E426')
" CleanUp
call CscopeSetupOrClean(0)
" cscope command should fail after killing scope connection.
call assert_fails('cscope find s main', 'E567')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+20
View File
@@ -2,9 +2,29 @@
func Test_invalid()
call assert_fails('call glob2regpat(1.33)', 'E806:')
call assert_fails('call glob2regpat("}")', 'E219:')
call assert_fails('call glob2regpat("{")', 'E220:')
endfunc
func Test_valid()
call assert_equal('^foo\.', glob2regpat('foo.*'))
call assert_equal('^foo.$', glob2regpat('foo?'))
call assert_equal('\.vim$', glob2regpat('*.vim'))
call assert_equal('^[abc]$', glob2regpat('[abc]'))
call assert_equal('^foo bar$', glob2regpat('foo\ bar'))
call assert_equal('^foo,bar$', glob2regpat('foo,bar'))
call assert_equal('^\(foo\|bar\)$', glob2regpat('{foo,bar}'))
call assert_equal('.*', glob2regpat('**'))
if exists('+shellslash')
call assert_equal('^foo[\/].$', glob2regpat('foo\?'))
call assert_equal('^\(foo[\/]\|bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}'))
call assert_equal('^[\/]\(foo\|bar[\/]\)$', glob2regpat('\{foo,bar\}'))
call assert_equal('^[\/][\/]\(foo\|bar[\/][\/]\)$', glob2regpat('\\{foo,bar\\}'))
else
call assert_equal('^foo?$', glob2regpat('foo\?'))
call assert_equal('^\(foo,bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}'))
call assert_equal('^{foo,bar}$', glob2regpat('\{foo,bar\}'))
call assert_equal('^\\\(foo\|bar\\\)$', glob2regpat('\\{foo,bar\\}'))
endif
endfunc
+8
View File
@@ -9,6 +9,14 @@ func SetUp()
if has("gui_kde")
set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0
endif
" Gnome insists on creating $HOME/.gnome2/..
call mkdir('Xhome')
let $HOME = fnamemodify('Xhome', ':p')
endfunc
func TearDown()
call delete('Xhome', 'rf')
endfunc
" Test for resetting "secure" flag after GUI has started.
+1 -1
View File
@@ -39,7 +39,7 @@ function! Test_lambda_with_timer()
call timer_stop(s:timer_id)
call assert_true(m > 1)
call assert_true(s:n > m + 1)
call assert_true(s:n < 9)
call assert_true(s:n < 10)
endfunction
function! Test_lambda_with_partial()
+165
View File
@@ -0,0 +1,165 @@
" Test for :match, :2match, :3match, clearmatches(), getmatches(), matchadd(),
" matchaddpos(), matcharg(), matchdelete(), matchstrpos() and setmatches().
function Test_matcharg()
highlight MyGroup1 term=bold ctermbg=red guibg=red
highlight MyGroup2 term=italic ctermbg=green guibg=green
highlight MyGroup3 term=underline ctermbg=blue guibg=blue
" --- Check that "matcharg()" returns the correct group and pattern if a match
" --- is defined.
match MyGroup1 /TODO/
2match MyGroup2 /FIXME/
3match MyGroup3 /XXX/
call assert_equal(['MyGroup1', 'TODO'], matcharg(1))
call assert_equal(['MyGroup2', 'FIXME'], matcharg(2))
call assert_equal(['MyGroup3', 'XXX'], matcharg(3))
" --- Check that "matcharg()" returns an empty list if the argument is not 1,
" --- 2 or 3 (only 0 and 4 are tested).
call assert_equal([], matcharg(0))
call assert_equal([], matcharg(4))
" --- Check that "matcharg()" returns ['', ''] if a match is not defined.
match
2match
3match
call assert_equal(['', ''], matcharg(1))
call assert_equal(['', ''], matcharg(2))
call assert_equal(['', ''], matcharg(3))
" --- Check that "matchadd()" and "getmatches()" agree on added matches and
" --- that default values apply.
let m1 = matchadd("MyGroup1", "TODO")
let m2 = matchadd("MyGroup2", "FIXME", 42)
let m3 = matchadd("MyGroup3", "XXX", 60, 17)
let ans = [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 4},
\ {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 42, 'id': 5},
\ {'group': 'MyGroup3', 'pattern': 'XXX', 'priority': 60, 'id': 17}]
call assert_equal(ans, getmatches())
" --- Check that "matchdelete()" deletes the matches defined in the previous
" --- test correctly.
call matchdelete(m1)
call matchdelete(m2)
call matchdelete(m3)
call assert_equal([], getmatches())
" --- Check that "matchdelete()" returns 0 if successful and otherwise -1.
let m = matchadd("MyGroup1", "TODO")
call assert_equal(0, matchdelete(m))
call assert_fails('call matchdelete(42)', 'E803:')
" --- Check that "clearmatches()" clears all matches defined by ":match" and
" --- "matchadd()".
let m1 = matchadd("MyGroup1", "TODO")
let m2 = matchadd("MyGroup2", "FIXME", 42)
let m3 = matchadd("MyGroup3", "XXX", 60, 17)
match MyGroup1 /COFFEE/
2match MyGroup2 /HUMPPA/
3match MyGroup3 /VIM/
call clearmatches()
call assert_equal([], getmatches())
" --- Check that "setmatches()" restores a list of matches saved by
" --- "getmatches()" without changes. (Matches with equal priority must also
" --- remain in the same order.)
let m1 = matchadd("MyGroup1", "TODO")
let m2 = matchadd("MyGroup2", "FIXME", 42)
let m3 = matchadd("MyGroup3", "XXX", 60, 17)
match MyGroup1 /COFFEE/
2match MyGroup2 /HUMPPA/
3match MyGroup3 /VIM/
let ml = getmatches()
call clearmatches()
call setmatches(ml)
call assert_equal(ml, getmatches())
call clearmatches()
" --- Check that "setmatches()" will not add two matches with the same ID. The
" --- expected behaviour (for now) is to add the first match but not the
" --- second and to return 0 (even though it is a matter of debate whether
" --- this can be considered successful behaviour).
let data = [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1},
\ {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}]
call assert_fails('call setmatches(data)', 'E801:')
call assert_equal([data[0]], getmatches())
call clearmatches()
" --- Check that "setmatches()" returns 0 if successful and otherwise -1.
" --- (A range of valid and invalid input values are tried out to generate the
" --- return values.)
call assert_equal(0, setmatches([]))
call assert_equal(0, setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}]))
call clearmatches()
call assert_fails('call setmatches(0)', 'E714:')
call assert_fails('call setmatches([0])', 'E474:')
call assert_fails("call setmatches([{'wrong key': 'wrong value'}])", 'E474:')
call setline(1, 'abcdefghijklmnopq')
call matchaddpos("MyGroup1", [[1, 5], [1, 8, 3]], 10, 3)
1
redraw!
let v1 = screenattr(1, 1)
let v5 = screenattr(1, 5)
let v6 = screenattr(1, 6)
let v8 = screenattr(1, 8)
let v10 = screenattr(1, 10)
let v11 = screenattr(1, 11)
call assert_notequal(v1, v5)
call assert_equal(v6, v1)
call assert_equal(v8, v5)
call assert_equal(v10, v5)
call assert_equal(v11, v1)
call assert_equal([{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}], getmatches())
call clearmatches()
"
if has('multi_byte')
call setline(1, 'abcdΣabcdef')
call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]])
1
redraw!
let v1 = screenattr(1, 1)
let v4 = screenattr(1, 4)
let v5 = screenattr(1, 5)
let v6 = screenattr(1, 6)
let v7 = screenattr(1, 7)
let v8 = screenattr(1, 8)
let v9 = screenattr(1, 9)
let v10 = screenattr(1, 10)
call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}], getmatches())
call assert_notequal(v1, v4)
call assert_equal(v5, v4)
call assert_equal(v6, v1)
call assert_equal(v7, v1)
call assert_equal(v8, v4)
call assert_equal(v9, v4)
call assert_equal(v10, v1)
" Check, that setmatches() can correctly restore the matches from matchaddpos()
call matchadd('MyGroup1', '\%2lmatchadd')
let m=getmatches()
call clearmatches()
call setmatches(m)
call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1,9, 2]}, {'group': 'MyGroup1', 'pattern': '\%2lmatchadd', 'priority': 10, 'id': 12}], getmatches())
endif
highlight MyGroup1 NONE
highlight MyGroup2 NONE
highlight MyGroup3 NONE
endfunc
func Test_matchstrpos()
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing'))
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2))
call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5))
call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing'))
call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img'))
endfunc
" vim: et ts=2 sw=2
-13
View File
@@ -1,13 +0,0 @@
" Test matchstrpos
func Test_matchstrpos()
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing'))
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2))
call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5))
call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing'))
call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img'))
endfunc
-23
View File
@@ -1,23 +0,0 @@
Test for ":options".
STARTTEST
:so small.vim
:let caught = 'ok'
:try
:options
:catch
:let caught = v:throwpoint . "\n" . v:exception
:endtry
:buf 1
:$put =caught
:"
:" Test that changing 'path' keeps two commas.
:set path=foo,,bar
:set path-=bar
:set path+=bar
:$put =&path
:/^result/,$w! test.out
:qa!
ENDTEST
result
-3
View File
@@ -1,3 +0,0 @@
result
ok
foo,,bar
+40
View File
@@ -0,0 +1,40 @@
" Test for options
function! Test_whichwrap()
set whichwrap=b,s
call assert_equal('b,s', &whichwrap)
set whichwrap+=h,l
call assert_equal('b,s,h,l', &whichwrap)
set whichwrap+=h,l
call assert_equal('b,s,h,l', &whichwrap)
set whichwrap+=h,l
call assert_equal('b,s,h,l', &whichwrap)
set whichwrap&
endfunction
function! Test_options()
let caught = 'ok'
try
options
catch
let caught = v:throwpoint . "\n" . v:exception
endtry
call assert_equal('ok', caught)
" close option-window
close
endfunction
function! Test_path_keep_commas()
" Test that changing 'path' keeps two commas.
set path=foo,,bar
set path-=bar
set path+=bar
call assert_equal('foo,,bar', &path)
set path&
endfunction
+6 -5
View File
@@ -170,11 +170,12 @@ func! Test_popup_complete()
" Insert match immediately, if there is only one match
" <c-e> Should select a character from the line below
call append(1, ["December2015"])
:1
call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx')
call assert_equal(["December2015", "", "December2015"], getline(1,3))
%d
" TODO: test disabled because the code change has been reverted.
" call append(1, ["December2015"])
" :1
" call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx')
" call assert_equal(["December2015", "", "December2015"], getline(1,3))
" %d
" use menuone for 'completeopt'
" Since for the first <c-y> the menu is still shown, will only select
-22
View File
@@ -1,22 +0,0 @@
Tests for signs
STARTTEST
:so small.vim
:if !has("signs")
: e! test.ok
: wq! test.out
:endif
:"
:sign define JumpSign text=x
:exe 'sign place 42 line=2 name=JumpSign buffer=' . bufnr('')
:" Split the window to the bottom to verify :sign-jump will stay in the current
:" window if the buffer is displayed there
:bot split
:exe 'sign jump 42 buffer=' . bufnr('')
:call append(line('$'), winnr())
:$-1,$w! test.out
ENDTEST
STARTTEST
:qa!
ENDTEST
-2
View File
@@ -1,2 +0,0 @@
2
+183
View File
@@ -0,0 +1,183 @@
" Test for signs
if !has('signs')
finish
endif
func Test_sign()
new
call setline(1, ['a', 'b', 'c', 'd'])
" Define some signs.
" We can specify icons even if not all versions of vim support icons as
" icon is ignored when not supported. "(not supported)" is shown after
" the icon name when listing signs.
sign define Sign1 text=x
try
sign define Sign2 text=xy texthl=Title linehl=Error icon=../../pixmaps/stock_vim_find_help.png
catch /E255:/
" ignore error: E255: Couldn't read in sign data!
" This error can happen when running in gui.
" Some gui like Motif do not support the png icon format.
endtry
" Test listing signs.
let a=execute('sign list')
call assert_match("^\nsign Sign1 text=x \nsign Sign2 icon=../../pixmaps/stock_vim_find_help.png .*text=xy linehl=Error texthl=Title$", a)
let a=execute('sign list Sign1')
call assert_equal("\nsign Sign1 text=x ", a)
" Split the window to the bottom to verify sign jump will stay in the current window
" if the buffer is displayed there.
let bn = bufnr('%')
let wn = winnr()
exe 'sign place 41 line=3 name=Sign1 buffer=' . bn
1
bot split
exe 'sign jump 41 buffer=' . bufnr('%')
call assert_equal('c', getline('.'))
call assert_equal(3, winnr())
call assert_equal(bn, bufnr('%'))
call assert_notequal(wn, winnr())
" Create a new buffer and check that ":sign jump" switches to the old buffer.
1
new foo
call assert_notequal(bn, bufnr('%'))
exe 'sign jump 41 buffer=' . bn
call assert_equal(bn, bufnr('%'))
call assert_equal('c', getline('.'))
" Redraw to make sure that screen redraw with sign gets exercised,
" with and without 'rightleft'.
if has('rightleft')
set rightleft
redraw
set norightleft
endif
redraw
" Check that we can't change sign.
call assert_fails("exe 'sign place 40 name=Sign1 buffer=' . bufnr('%')", 'E885:')
" Check placed signs
let a=execute('sign place')
call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n line=3 id=41 name=Sign1\n", a)
" Unplace the sign and try jumping to it again should fail.
sign unplace 41
1
call assert_fails("exe 'sign jump 41 buffer=' . bufnr('%')", 'E157:')
call assert_equal('a', getline('.'))
" Unplace sign on current line.
exe 'sign place 42 line=4 name=Sign2 buffer=' . bufnr('%')
4
sign unplace
let a=execute('sign place')
call assert_equal("\n--- Signs ---\n", a)
" Try again to unplace sign on current line, it should fail this time.
call assert_fails('sign unplace', 'E159:')
" Unplace all signs.
exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%')
sign unplace *
let a=execute('sign place')
call assert_equal("\n--- Signs ---\n", a)
" Check :jump with file=...
edit foo
call setline(1, ['A', 'B', 'C', 'D'])
try
sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist icon=doesnotexist.xpm
catch /E255:/
" ignore error: E255: it can happens for guis.
endtry
let fn = expand('%:p')
exe 'sign place 43 line=2 name=Sign3 file=' . fn
edit bar
call assert_notequal(fn, expand('%:p'))
exe 'sign jump 43 file=' . fn
call assert_equal('B', getline('.'))
" After undefining the sign, we should no longer be able to place it.
sign undefine Sign1
sign undefine Sign2
sign undefine Sign3
call assert_fails("exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%')", 'E155:')
endfunc
" Undefining placed sign is not recommended.
" Quoting :help sign
"
" :sign undefine {name}
" Deletes a previously defined sign. If signs with this {name}
" are still placed this will cause trouble.
func Test_sign_undefine_still_placed()
new foobar
sign define Sign text=x
exe 'sign place 41 line=1 name=Sign buffer=' . bufnr('%')
sign undefine Sign
" Listing placed sign should show that sign is deleted.
let a=execute('sign place')
call assert_equal("\n--- Signs ---\nSigns for foobar:\n line=1 id=41 name=[Deleted]\n", a)
sign unplace 41
let a=execute('sign place')
call assert_equal("\n--- Signs ---\n", a)
endfunc
func Test_sign_completion()
sign define Sign1 text=x
sign define Sign2 text=y
call feedkeys(":sign \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign define jump list place undefine unplace', @:)
call feedkeys(":sign define Sign \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign define Sign icon= linehl= text= texthl=', @:)
call feedkeys(":sign define Sign linehl=Spell\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign define Sign linehl=SpellBad SpellCap SpellLocal SpellRare', @:)
call feedkeys(":sign define Sign icon=../../pixmaps/tb_p\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign define Sign icon=../../pixmaps/tb_paste.xpm ../../pixmaps/tb_print.xpm', @:)
call feedkeys(":sign undefine \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign undefine Sign1 Sign2', @:)
call feedkeys(":sign place 1 \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign place 1 buffer= file= line= name=', @:)
call feedkeys(":sign place 1 name=\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign place 1 name=Sign1 Sign2', @:)
call feedkeys(":sign unplace 1 \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign unplace 1 buffer= file=', @:)
call feedkeys(":sign list \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign list Sign1 Sign2', @:)
call feedkeys(":sign jump 1 \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"sign jump 1 buffer= file=', @:)
sign undefine Sign1
sign undefine Sign2
endfunc
func Test_sign_invalid_commands()
call assert_fails('sign', 'E471:')
call assert_fails('sign jump', 'E471:')
call assert_fails('sign xxx', 'E160:')
call assert_fails('sign define', 'E156:')
call assert_fails('sign define Sign1 xxx', 'E475:')
call assert_fails('sign undefine', 'E156:')
call assert_fails('sign list xxx', 'E155:')
call assert_fails('sign place 1 buffer=', 'E158:')
call assert_fails('sign define Sign2 text=', 'E239:')
endfunc
+178 -1
View File
@@ -1,8 +1,185 @@
" Check that loading startup.vim works.
" Tests for startup.
source shared.vim
" Check that loading startup.vim works.
func Test_startup_script()
set compatible
source $VIMRUNTIME/defaults.vim
call assert_equal(0, &compatible)
endfunc
" Verify the order in which plugins are loaded:
" 1. plugins in non-after directories
" 2. packages
" 3. plugins in after directories
func Test_after_comes_later()
if !has('packages')
return
endif
let before = [
\ 'set nocp viminfo+=nviminfo',
\ 'set guioptions+=M',
\ 'let $HOME = "/does/not/exist"',
\ 'set loadplugins',
\ 'set rtp=Xhere,Xafter',
\ 'set packpath=Xhere,Xafter',
\ 'set nomore',
\ ]
let after = [
\ 'redir! > Xtestout',
\ 'scriptnames',
\ 'redir END',
\ 'quit',
\ ]
call mkdir('Xhere/plugin', 'p')
call writefile(['let done = 1'], 'Xhere/plugin/here.vim')
call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p')
call writefile(['let done = 1'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim')
call mkdir('Xafter/plugin', 'p')
call writefile(['let done = 1'], 'Xafter/plugin/later.vim')
if RunVim(before, after, '')
let lines = readfile('Xtestout')
let expected = ['Xbefore.vim', 'here.vim', 'foo.vim', 'later.vim', 'Xafter.vim']
let found = []
for line in lines
for one in expected
if line =~ one
call add(found, one)
endif
endfor
endfor
call assert_equal(expected, found)
endif
call delete('Xtestout')
call delete('Xhere', 'rf')
call delete('Xafter', 'rf')
endfunc
func Test_help_arg()
if !has('unix') && has('gui')
" this doesn't work with gvim on MS-Windows
return
endif
if RunVim([], [], '--help >Xtestout')
let lines = readfile('Xtestout')
call assert_true(len(lines) > 20)
call assert_match('Vi IMproved', lines[0])
" check if couple of lines are there
let found = []
for line in lines
if line =~ '-R.*Readonly mode'
call add(found, 'Readonly mode')
endif
" Watch out for a second --version line in the Gnome version.
if line =~ '--version.*Print version information and exit'
call add(found, "--version")
endif
endfor
call assert_equal(['Readonly mode', '--version'], found)
endif
call delete('Xtestout')
endfunc
func Test_compatible_args()
let after = [
\ 'call writefile([string(&compatible)], "Xtestout")',
\ 'set viminfo+=nviminfo',
\ 'quit',
\ ]
if RunVim([], after, '-C')
let lines = readfile('Xtestout')
call assert_equal('1', lines[0])
endif
if RunVim([], after, '-N')
let lines = readfile('Xtestout')
call assert_equal('0', lines[0])
endif
call delete('Xtestout')
endfunc
func Test_file_args()
let after = [
\ 'call writefile(argv(), "Xtestout")',
\ 'qall',
\ ]
if RunVim([], after, '')
let lines = readfile('Xtestout')
call assert_equal(0, len(lines))
endif
if RunVim([], after, 'one')
let lines = readfile('Xtestout')
call assert_equal(1, len(lines))
call assert_equal('one', lines[0])
endif
if RunVim([], after, 'one two three')
let lines = readfile('Xtestout')
call assert_equal(3, len(lines))
call assert_equal('one', lines[0])
call assert_equal('two', lines[1])
call assert_equal('three', lines[2])
endif
if RunVim([], after, 'one -c echo two')
let lines = readfile('Xtestout')
call assert_equal(2, len(lines))
call assert_equal('one', lines[0])
call assert_equal('two', lines[1])
endif
if RunVim([], after, 'one -- -c echo two')
let lines = readfile('Xtestout')
call assert_equal(4, len(lines))
call assert_equal('one', lines[0])
call assert_equal('-c', lines[1])
call assert_equal('echo', lines[2])
call assert_equal('two', lines[3])
endif
call delete('Xtestout')
endfunc
func Test_startuptime()
if !has('startuptime')
return
endif
let after = ['qall']
if RunVim([], after, '--startuptime Xtestout one')
let lines = readfile('Xtestout')
let expected = ['--- VIM STARTING ---', 'parsing arguments',
\ 'shell init', 'inits 3', 'start termcap', 'opening buffers']
let found = []
for line in lines
for exp in expected
if line =~ exp
call add(found, exp)
endif
endfor
endfor
call assert_equal(expected, found)
endif
call delete('Xtestout')
endfunc
func Test_read_stdin()
let after = [
\ 'write Xtestout',
\ 'quit!',
\ ]
if RunVimPiped([], after, '-', 'echo something | ')
let lines = readfile('Xtestout')
" MS-Windows adds a space after the word
call assert_equal(['something'], split(lines[0]))
endif
call delete('Xtestout')
endfunc
+64
View File
@@ -0,0 +1,64 @@
" Tests for startup using utf-8.
if !has('multi_byte')
finish
endif
source shared.vim
func Test_read_stdin_utf8()
let linesin = ['テスト', '€ÀÈÌÒÙ']
call writefile(linesin, 'Xtestin')
let before = [
\ 'set enc=utf-8',
\ 'set fencs=cp932,utf-8',
\ ]
let after = [
\ 'write ++enc=utf-8 Xtestout',
\ 'quit!',
\ ]
if has('win32')
let pipecmd = 'type Xtestin | '
else
let pipecmd = 'cat Xtestin | '
endif
if RunVimPiped(before, after, '-', pipecmd)
let lines = readfile('Xtestout')
call assert_equal(linesin, lines)
else
call assert_equal('', 'RunVimPiped failed.')
endif
call delete('Xtestout')
call delete('Xtestin')
endfunc
func Test_read_fifo_utf8()
if !has('unix')
return
endif
" Using bash/zsh's process substitution.
if executable('bash')
set shell=bash
elseif executable('zsh')
set shell=zsh
else
return
endif
let linesin = ['テスト', '€ÀÈÌÒÙ']
call writefile(linesin, 'Xtestin')
let before = [
\ 'set enc=utf-8',
\ 'set fencs=cp932,utf-8',
\ ]
let after = [
\ 'write ++enc=utf-8 Xtestout',
\ 'quit!',
\ ]
if RunVim(before, after, '<(cat Xtestin)')
let lines = readfile('Xtestout')
call assert_equal(linesin, lines)
else
call assert_equal('', 'RunVim failed.')
endif
call delete('Xtestout')
call delete('Xtestin')
endfunc
+76 -16
View File
@@ -1,11 +1,13 @@
" Test for timers
source shared.vim
if !has('timers')
finish
endif
func MyHandler(timer)
let s:val += 1
let g:val += 1
endfunc
func MyHandlerWithLists(lists, timer)
@@ -13,43 +15,101 @@ func MyHandlerWithLists(lists, timer)
endfunc
func Test_oneshot()
let s:val = 0
let g:val = 0
let timer = timer_start(50, 'MyHandler')
sleep 200m
call assert_equal(1, s:val)
let slept = WaitFor('g:val == 1')
call assert_equal(1, g:val)
call assert_inrange(30, 100, slept)
endfunc
func Test_repeat_three()
let s:val = 0
let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': 3})
sleep 500m
call assert_equal(3, s:val)
let slept = WaitFor('g:val == 3')
call assert_equal(3, g:val)
call assert_inrange(80, 200, slept)
endfunc
func Test_repeat_many()
let s:val = 0
let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': -1})
sleep 200m
call timer_stop(timer)
call assert_true(s:val > 1)
call assert_true(s:val < 5)
call assert_inrange(2, 4, g:val)
endfunc
func Test_with_partial_callback()
let s:val = 0
let g:val = 0
let s:meow = {}
function s:meow.bite(...)
let s:val += 1
let g:val += 1
endfunction
call timer_start(50, s:meow.bite)
sleep 200m
call assert_equal(1, s:val)
let slept = WaitFor('g:val == 1')
call assert_equal(1, g:val)
call assert_inrange(30, 100, slept)
endfunc
func Test_retain_partial()
call timer_start(100, function('MyHandlerWithLists', [['a']]))
call timer_start(50, function('MyHandlerWithLists', [['a']]))
call test_garbagecollect_now()
sleep 200m
sleep 100m
endfunc
func Test_info()
let id = timer_start(1000, 'MyHandler')
let info = timer_info(id)
call assert_equal(id, info[0]['id'])
call assert_equal(1000, info[0]['time'])
call assert_true(info[0]['remaining'] > 500)
call assert_true(info[0]['remaining'] <= 1000)
call assert_equal(1, info[0]['repeat'])
call assert_equal("function('MyHandler')", string(info[0]['callback']))
let found = 0
for info in timer_info()
if info['id'] == id
let found += 1
endif
endfor
call assert_equal(1, found)
call timer_stop(id)
call assert_equal([], timer_info(id))
endfunc
func Test_stopall()
let id1 = timer_start(1000, 'MyHandler')
let id2 = timer_start(2000, 'MyHandler')
let info = timer_info()
call assert_equal(2, len(info))
call timer_stopall()
let info = timer_info()
call assert_equal(0, len(info))
endfunc
func Test_paused()
let g:val = 0
let id = timer_start(50, 'MyHandler')
let info = timer_info(id)
call assert_equal(0, info[0]['paused'])
call timer_pause(id, 1)
let info = timer_info(id)
call assert_equal(1, info[0]['paused'])
sleep 100m
call assert_equal(0, g:val)
call timer_pause(id, 0)
let info = timer_info(id)
call assert_equal(0, info[0]['paused'])
let slept = WaitFor('g:val == 1')
call assert_equal(1, g:val)
call assert_inrange(0, 10, slept)
endfunc
" vim: ts=2 sw=0 et
+70
View File
@@ -778,6 +778,76 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2196,
/**/
2195,
/**/
2194,
/**/
2193,
/**/
2192,
/**/
2191,
/**/
2190,
/**/
2189,
/**/
2188,
/**/
2187,
/**/
2186,
/**/
2185,
/**/
2184,
/**/
2183,
/**/
2182,
/**/
2181,
/**/
2180,
/**/
2179,
/**/
2178,
/**/
2177,
/**/
2176,
/**/
2175,
/**/
2174,
/**/
2173,
/**/
2172,
/**/
2171,
/**/
2170,
/**/
2169,
/**/
2168,
/**/
2167,
/**/
2166,
/**/
2165,
/**/
2164,
/**/
2163,
/**/
2162,
/**/
2161,
/**/
+5 -7
View File
@@ -983,7 +983,8 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define READ_STDIN 0x04 /* read from stdin */
#define READ_BUFFER 0x08 /* read from curbuf (converting stdin) */
#define READ_DUMMY 0x10 /* reading into a dummy buffer */
#define READ_KEEP_UNDO 0x20 /* keep undo info*/
#define READ_KEEP_UNDO 0x20 /* keep undo info */
#define READ_FIFO 0x40 /* read from fifo or socket */
/* Values for change_indent() */
#define INDENT_SET 1 /* set indent */
@@ -2111,7 +2112,7 @@ typedef enum
* been seen at that stage. But it must be before globals.h, where error_ga
* is declared. */
#if !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_X11) \
&& !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC)
&& !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) && !defined(PROTO)
# define mch_errmsg(str) fprintf(stderr, "%s", (str))
# define display_errors() fflush(stderr)
# define mch_msg(str) printf("%s", (str))
@@ -2442,11 +2443,6 @@ typedef enum
#define JSON_JS 1 /* use JS instead of JSON */
#define JSON_NO_NONE 2 /* v:none item not allowed */
#ifdef FEAT_MZSCHEME
/* this is in main.c, cproto can't handle it. */
int vim_main2(int argc, char **argv);
#endif
/* Used for flags of do_in_path() */
#define DIP_ALL 0x01 /* all matches, not just the first one */
#define DIP_DIR 0x02 /* find directories instead of files. */
@@ -2454,6 +2450,8 @@ int vim_main2(int argc, char **argv);
#define DIP_START 0x08 /* also use "start" directory in 'packpath' */
#define DIP_OPT 0x10 /* also use "opt" directory in 'packpath' */
#define DIP_NORTP 0x20 /* do not use 'runtimepath' */
#define DIP_NOAFTER 0x40 /* skip "after" directories */
#define DIP_AFTER 0x80 /* only use "after" directories */
/* Lowest number used for window ID. Cannot have this many windows. */
#define LOWEST_WIN_ID 1000
+21 -46
View File
@@ -17,89 +17,66 @@
#include <stdio.h>
#include <stdlib.h>
#ifndef __CYGWIN__
# include <conio.h>
#include <conio.h>
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef __BORLANDC__
extern char *
#ifdef _RTLDLL
__import
#endif
_oscmd;
# define _kbhit kbhit
# define _getch getch
#else
# ifdef __MINGW32__
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# else
# ifdef __CYGWIN__
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# define _getch getchar
# else
extern char *_acmdln;
# endif
# endif
#endif
int
main(void)
{
const char *p;
int retval;
int inquote = 0;
int silent = 0;
const wchar_t *p;
int retval;
int inquote = 0;
int silent = 0;
HANDLE hstdout;
DWORD written;
p = (const wchar_t *)GetCommandLineW();
#ifdef __BORLANDC__
p = _oscmd;
#else
# if defined(__MINGW32__) || defined(__CYGWIN__)
p = (const char *)GetCommandLine();
# else
p = _acmdln;
# endif
#endif
/*
* Skip the executable name, which might be in "".
*/
while (*p)
{
if (*p == '"')
if (*p == L'"')
inquote = !inquote;
else if (!inquote && *p == ' ')
else if (!inquote && *p == L' ')
{
++p;
break;
}
++p;
}
while (*p == ' ')
while (*p == L' ')
++p;
/*
* "-s" argument: don't wait for a key hit.
*/
if (p[0] == '-' && p[1] == 's' && p[2] == ' ')
if (p[0] == L'-' && p[1] == L's' && p[2] == L' ')
{
silent = 1;
p += 3;
while (*p == ' ')
while (*p == L' ')
++p;
}
/* Print the command, including quotes and redirection. */
puts(p);
hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
WriteConsoleW(hstdout, p, wcslen(p), &written, NULL);
WriteConsoleW(hstdout, L"\r\n", 2, &written, NULL);
/*
* Do it!
*/
retval = system(p);
retval = _wsystem(p);
if (retval == -1)
perror("vimrun system(): ");
@@ -110,10 +87,8 @@ main(void)
{
puts("Hit any key to close this window...");
#ifndef __CYGWIN__
while (_kbhit())
(void)_getch();
#endif
(void)_getch();
}
+4 -1
View File
@@ -5810,6 +5810,9 @@ win_new_height(win_T *wp, int height)
void
win_new_width(win_T *wp, int width)
{
#ifdef FEAT_GUI_MACVIM
int resized = wp->w_width != width;
#endif
wp->w_width = width;
wp->w_lines_valid = 0;
changed_line_abv_curs_win(wp);
@@ -5821,7 +5824,7 @@ win_new_width(win_T *wp, int width)
}
#ifdef FEAT_GUI_MACVIM
/* The view may have moved, so clear all or display may get corrupted. */
redraw_win_later(wp, gui.in_use ? CLEAR : NOT_VALID);
redraw_win_later(wp, resized && gui.in_use ? CLEAR : NOT_VALID);
#else
redraw_win_later(wp, NOT_VALID);
#endif