Compare commits

...

13 Commits

Author SHA1 Message Date
Bram Moolenaar
3f3897e41f patch 8.0.0407: filtering folds with marker method not tested
Problem:    Filtering folds with marker method not tested.
Solution:   Also set 'foldmethod' to "marker".
2017-03-04 15:28:53 +01:00
Bram Moolenaar
7f73b54631 patch 8.0.0406: arabic shaping code is verbose
Problem:    The arabic shaping code is verbose.
Solution:   Shorten the code without changing the functionality.
2017-03-04 14:50:19 +01:00
Bram Moolenaar
08cab96087 patch 8.0.0405: v:progpath may become invalid after :cd
Problem:    v:progpath may become invalid after ":cd".
Solution:   Turn v:progpath into a full path if needed.
2017-03-04 14:37:18 +01:00
Bram Moolenaar
391b1dd040 patch 8.0.0404: not enough testing for quickfix
Problem:    Not enough testing for quickfix.
Solution:   Add some more tests. (Yegappan Lakshmanan)
2017-03-04 13:47:11 +01:00
Bram Moolenaar
24d7636e98 patch 8.0.0403: GUI tests may fail
Problem:    GUI tests may fail.
Solution:   Ignore the E285 error better. (Kazunobu Kuriyama)
2017-03-04 13:32:10 +01:00
Bram Moolenaar
cf5fdf7d16 patch 8.0.0402: :map completion does not have <special>
Problem:    :map completion does not have <special>. (Dominique Pelle)
Solution:   Recognize <special> in completion.  Add a test.
2017-03-02 23:05:51 +01:00
Bram Moolenaar
a0107bdf87 patch 8.0.0401: test fails with missing balloon feature
Problem:    Test fails with missing balloon feature.
Solution:   Add check for balloon feature.
2017-03-02 22:48:01 +01:00
Bram Moolenaar
358f6b0a36 patch 8.0.0400: some tests have a one second delay
Problem:    Some tests have a one second delay.
Solution:   Add --not-a-term in RunVim().
2017-03-02 22:43:01 +01:00
Bram Moolenaar
caf6434ac9 patch 8.0.0399: crash when using balloon_show() when not supported
Problem:    Crash when using balloon_show() when not supported. (Hirohito
            Higashi)
Solution:   Check for balloonEval not to be NULL. (Ken Takata)
2017-03-02 22:11:33 +01:00
Bram Moolenaar
66727e1607 patch 8.0.0398: illegal memory access with "t"
Problem:    Illegal memory access with "t".
Solution:   Use strncmp() instead of memcmp(). (Dominique Pelle, closes #1528)
2017-03-01 22:17:05 +01:00
Bram Moolenaar
5a66dfb25e patch 8.0.0397: can't build with +viminfo but without +eval
Problem:    Cannot build with the viminfo feature but without the eval
            feature.
Solution:   Adjust #ifdef. (John Marriott)
2017-03-01 20:40:39 +01:00
Bram Moolenaar
59716a27bd patch 8.0.0396: 'balloonexpr' only works synchronously
Problem:    'balloonexpr' only works synchronously.
Solution:   Add balloon_show(). (Jusufadis Bakamovic, closes #1449)
2017-03-01 20:32:44 +01:00
Bram Moolenaar
f8ab1b14fd patch 8.0.0395: testing the + register fails with Motif
Problem:    Testing the + register fails with Motif.
Solution:   Also ignore the "failed to create input context" error in the
            second gvim.  Don't use msg() when it would result in a dialog.
2017-03-01 18:30:34 +01:00
21 changed files with 406 additions and 363 deletions

View File

@@ -1789,8 +1789,11 @@ v:progpath Contains the command with which Vim was invoked, including the
|--remote-expr|.
To get the full path use: >
echo exepath(v:progpath)
< NOTE: This does not work when the command is a relative path
and the current directory has changed.
< If the path is relative it will be expanded to the full path,
so that it still works after `:cd`. Thus starting "./vim"
results in "/home/user/path/to/vim/src/vim".
On MS-Windows the executable may be called "vim.exe", but the
".exe" is not added to v:progpath.
Read-only.
*v:register* *register-variable*
@@ -1981,19 +1984,20 @@ argidx() Number current index in the argument list
arglistid([{winnr} [, {tabnr}]]) Number argument list id
argv({nr}) String {nr} entry of the argument list
argv() List the argument list
assert_equal({exp}, {act} [, {msg}]) none assert {exp} is equal to {act}
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_equal({exp}, {act} [, {msg}]) none assert {exp} is equal to {act}
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
assert_match({pat}, {text} [, {msg}]) none assert {pat} matches {text}
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}
assert_true({actual} [, {msg}]) none assert {actual} is true
assert_true({actual} [, {msg}]) none assert {actual} is true
asin({expr}) Float arc sine of {expr}
atan({expr}) Float arc tangent of {expr}
atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2}
balloon_show({msg}) none show {msg} inside the balloon
browse({save}, {title}, {initdir}, {default})
String put up a file requester
browsedir({title}, {initdir}) String put up a directory requester
@@ -2619,6 +2623,25 @@ atan2({expr1}, {expr2}) *atan2()*
< 2.356194
{only available when compiled with the |+float| feature}
balloon_show({msg}) *balloon_show()*
Show {msg} inside the balloon.
Example: >
func GetBalloonContent()
" initiate getting the content
return ''
endfunc
set balloonexpr=GetBalloonContent()
func BalloonCallback(result)
call balloon_show(a:result)
endfunc
<
The intended use is that fetching the content of the balloon
is initiated from 'balloonexpr'. It will invoke an
asynchronous method, in which a callback invokes
balloon_show(). The 'balloonexpr' itself can return an
empty string or a placeholder.
{only available when compiled with the +beval feature}
*browse()*
browse({save}, {title}, {initdir}, {default})

View File

@@ -240,7 +240,6 @@ chg_c_a2s(int cur_c)
case a_HEH: return a_s_HEH;
case a_YEH: return a_s_YEH;
}
return 0;
}
@@ -305,7 +304,6 @@ chg_c_a2i(int cur_c)
case a_HEH: return a_i_HEH;
case a_YEH: return a_i_YEH;
}
return 0;
}
@@ -356,7 +354,6 @@ chg_c_a2m(int cur_c)
case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA; /* exception */
case a_YEH: return a_m_YEH;
}
return 0;
}
@@ -367,136 +364,55 @@ chg_c_a2m(int cur_c)
static int
chg_c_a2f(int cur_c)
{
int tempc;
/* NOTE: these encodings need to be accounted for
a_f_ALEF_MADDA;
a_f_ALEF_HAMZA_ABOVE;
a_f_ALEF_HAMZA_BELOW;
a_f_LAM_ALEF_MADDA_ABOVE;
a_f_LAM_ALEF_HAMZA_ABOVE;
a_f_LAM_ALEF_HAMZA_BELOW;
*/
* a_f_ALEF_MADDA;
* a_f_ALEF_HAMZA_ABOVE;
* a_f_ALEF_HAMZA_BELOW;
* a_f_LAM_ALEF_MADDA_ABOVE;
* a_f_LAM_ALEF_HAMZA_ABOVE;
* a_f_LAM_ALEF_HAMZA_BELOW;
*/
switch (cur_c)
{
case a_HAMZA: /* exception */
tempc = a_s_HAMZA;
break;
case a_ALEF_MADDA:
tempc = a_f_ALEF_MADDA;
break;
case a_ALEF_HAMZA_ABOVE:
tempc = a_f_ALEF_HAMZA_ABOVE;
break;
case a_WAW_HAMZA:
tempc = a_f_WAW_HAMZA;
break;
case a_ALEF_HAMZA_BELOW:
tempc = a_f_ALEF_HAMZA_BELOW;
break;
case a_YEH_HAMZA:
tempc = a_f_YEH_HAMZA;
break;
case a_ALEF:
tempc = a_f_ALEF;
break;
case a_BEH:
tempc = a_f_BEH;
break;
case a_TEH_MARBUTA:
tempc = a_f_TEH_MARBUTA;
break;
case a_TEH:
tempc = a_f_TEH;
break;
case a_THEH:
tempc = a_f_THEH;
break;
case a_JEEM:
tempc = a_f_JEEM;
break;
case a_HAH:
tempc = a_f_HAH;
break;
case a_KHAH:
tempc = a_f_KHAH;
break;
case a_DAL:
tempc = a_f_DAL;
break;
case a_THAL:
tempc = a_f_THAL;
break;
case a_REH:
tempc = a_f_REH;
break;
case a_ZAIN:
tempc = a_f_ZAIN;
break;
case a_SEEN:
tempc = a_f_SEEN;
break;
case a_SHEEN:
tempc = a_f_SHEEN;
break;
case a_SAD:
tempc = a_f_SAD;
break;
case a_DAD:
tempc = a_f_DAD;
break;
case a_TAH:
tempc = a_f_TAH;
break;
case a_ZAH:
tempc = a_f_ZAH;
break;
case a_AIN:
tempc = a_f_AIN;
break;
case a_GHAIN:
tempc = a_f_GHAIN;
break;
case a_TATWEEL: /* exception */
tempc = cur_c;
break;
case a_FEH:
tempc = a_f_FEH;
break;
case a_QAF:
tempc = a_f_QAF;
break;
case a_KAF:
tempc = a_f_KAF;
break;
case a_LAM:
tempc = a_f_LAM;
break;
case a_MEEM:
tempc = a_f_MEEM;
break;
case a_NOON:
tempc = a_f_NOON;
break;
case a_HEH:
tempc = a_f_HEH;
break;
case a_WAW:
tempc = a_f_WAW;
break;
case a_ALEF_MAKSURA:
tempc = a_f_ALEF_MAKSURA;
break;
case a_YEH:
tempc = a_f_YEH;
break;
default:
tempc = 0;
case a_HAMZA: return a_s_HAMZA; /* exception */
case a_ALEF_MADDA: return a_f_ALEF_MADDA;
case a_ALEF_HAMZA_ABOVE: return a_f_ALEF_HAMZA_ABOVE;
case a_WAW_HAMZA: return a_f_WAW_HAMZA;
case a_ALEF_HAMZA_BELOW: return a_f_ALEF_HAMZA_BELOW;
case a_YEH_HAMZA: return a_f_YEH_HAMZA;
case a_ALEF: return a_f_ALEF;
case a_BEH: return a_f_BEH;
case a_TEH_MARBUTA: return a_f_TEH_MARBUTA;
case a_TEH: return a_f_TEH;
case a_THEH: return a_f_THEH;
case a_JEEM: return a_f_JEEM;
case a_HAH: return a_f_HAH;
case a_KHAH: return a_f_KHAH;
case a_DAL: return a_f_DAL;
case a_THAL: return a_f_THAL;
case a_REH: return a_f_REH;
case a_ZAIN: return a_f_ZAIN;
case a_SEEN: return a_f_SEEN;
case a_SHEEN: return a_f_SHEEN;
case a_SAD: return a_f_SAD;
case a_DAD: return a_f_DAD;
case a_TAH: return a_f_TAH;
case a_ZAH: return a_f_ZAH;
case a_AIN: return a_f_AIN;
case a_GHAIN: return a_f_GHAIN;
case a_TATWEEL: return cur_c; /* exception */
case a_FEH: return a_f_FEH;
case a_QAF: return a_f_QAF;
case a_KAF: return a_f_KAF;
case a_LAM: return a_f_LAM;
case a_MEEM: return a_f_MEEM;
case a_NOON: return a_f_NOON;
case a_HEH: return a_f_HEH;
case a_WAW: return a_f_WAW;
case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA;
case a_YEH: return a_f_YEH;
}
return tempc;
return 0;
}
@@ -506,84 +422,33 @@ chg_c_a2f(int cur_c)
static int
chg_c_i2m(int cur_c)
{
int tempc;
switch (cur_c)
{
case a_i_YEH_HAMZA:
tempc = a_m_YEH_HAMZA;
break;
case a_i_BEH:
tempc = a_m_BEH;
break;
case a_i_TEH:
tempc = a_m_TEH;
break;
case a_i_THEH:
tempc = a_m_THEH;
break;
case a_i_JEEM:
tempc = a_m_JEEM;
break;
case a_i_HAH:
tempc = a_m_HAH;
break;
case a_i_KHAH:
tempc = a_m_KHAH;
break;
case a_i_SEEN:
tempc = a_m_SEEN;
break;
case a_i_SHEEN:
tempc = a_m_SHEEN;
break;
case a_i_SAD:
tempc = a_m_SAD;
break;
case a_i_DAD:
tempc = a_m_DAD;
break;
case a_i_TAH:
tempc = a_m_TAH;
break;
case a_i_ZAH:
tempc = a_m_ZAH;
break;
case a_i_AIN:
tempc = a_m_AIN;
break;
case a_i_GHAIN:
tempc = a_m_GHAIN;
break;
case a_i_FEH:
tempc = a_m_FEH;
break;
case a_i_QAF:
tempc = a_m_QAF;
break;
case a_i_KAF:
tempc = a_m_KAF;
break;
case a_i_LAM:
tempc = a_m_LAM;
break;
case a_i_MEEM:
tempc = a_m_MEEM;
break;
case a_i_NOON:
tempc = a_m_NOON;
break;
case a_i_HEH:
tempc = a_m_HEH;
break;
case a_i_YEH:
tempc = a_m_YEH;
break;
default:
tempc = 0;
case a_i_YEH_HAMZA: return a_m_YEH_HAMZA;
case a_i_BEH: return a_m_BEH;
case a_i_TEH: return a_m_TEH;
case a_i_THEH: return a_m_THEH;
case a_i_JEEM: return a_m_JEEM;
case a_i_HAH: return a_m_HAH;
case a_i_KHAH: return a_m_KHAH;
case a_i_SEEN: return a_m_SEEN;
case a_i_SHEEN: return a_m_SHEEN;
case a_i_SAD: return a_m_SAD;
case a_i_DAD: return a_m_DAD;
case a_i_TAH: return a_m_TAH;
case a_i_ZAH: return a_m_ZAH;
case a_i_AIN: return a_m_AIN;
case a_i_GHAIN: return a_m_GHAIN;
case a_i_FEH: return a_m_FEH;
case a_i_QAF: return a_m_QAF;
case a_i_KAF: return a_m_KAF;
case a_i_LAM: return a_m_LAM;
case a_i_MEEM: return a_m_MEEM;
case a_i_NOON: return a_m_NOON;
case a_i_HEH: return a_m_HEH;
case a_i_YEH: return a_m_YEH;
}
return tempc;
return 0;
}
@@ -593,18 +458,14 @@ chg_c_i2m(int cur_c)
static int
chg_c_f2m(int cur_c)
{
int tempc;
switch (cur_c)
{
/* NOTE: these encodings are multi-positional, no ?
case a_f_ALEF_MADDA:
case a_f_ALEF_HAMZA_ABOVE:
case a_f_ALEF_HAMZA_BELOW:
*/
case a_f_YEH_HAMZA:
tempc = a_m_YEH_HAMZA;
break;
* case a_f_ALEF_MADDA:
* case a_f_ALEF_HAMZA_ABOVE:
* case a_f_ALEF_HAMZA_BELOW:
*/
case a_f_YEH_HAMZA: return a_m_YEH_HAMZA;
case a_f_WAW_HAMZA: /* exceptions */
case a_f_ALEF:
case a_f_TEH_MARBUTA:
@@ -614,85 +475,38 @@ chg_c_f2m(int cur_c)
case a_f_ZAIN:
case a_f_WAW:
case a_f_ALEF_MAKSURA:
tempc = cur_c;
break;
case a_f_BEH:
tempc = a_m_BEH;
break;
case a_f_TEH:
tempc = a_m_TEH;
break;
case a_f_THEH:
tempc = a_m_THEH;
break;
case a_f_JEEM:
tempc = a_m_JEEM;
break;
case a_f_HAH:
tempc = a_m_HAH;
break;
case a_f_KHAH:
tempc = a_m_KHAH;
break;
case a_f_SEEN:
tempc = a_m_SEEN;
break;
case a_f_SHEEN:
tempc = a_m_SHEEN;
break;
case a_f_SAD:
tempc = a_m_SAD;
break;
case a_f_DAD:
tempc = a_m_DAD;
break;
case a_f_TAH:
tempc = a_m_TAH;
break;
case a_f_ZAH:
tempc = a_m_ZAH;
break;
case a_f_AIN:
tempc = a_m_AIN;
break;
case a_f_GHAIN:
tempc = a_m_GHAIN;
break;
case a_f_FEH:
tempc = a_m_FEH;
break;
case a_f_QAF:
tempc = a_m_QAF;
break;
case a_f_KAF:
tempc = a_m_KAF;
break;
case a_f_LAM:
tempc = a_m_LAM;
break;
case a_f_MEEM:
tempc = a_m_MEEM;
break;
case a_f_NOON:
tempc = a_m_NOON;
break;
case a_f_HEH:
tempc = a_m_HEH;
break;
case a_f_YEH:
tempc = a_m_YEH;
break;
/* NOTE: these encodings are multi-positional, no ?
case a_f_LAM_ALEF_MADDA_ABOVE:
case a_f_LAM_ALEF_HAMZA_ABOVE:
case a_f_LAM_ALEF_HAMZA_BELOW:
case a_f_LAM_ALEF:
*/
default:
tempc = 0;
}
return cur_c;
case a_f_BEH: return a_m_BEH;
case a_f_TEH: return a_m_TEH;
case a_f_THEH: return a_m_THEH;
case a_f_JEEM: return a_m_JEEM;
case a_f_HAH: return a_m_HAH;
case a_f_KHAH: return a_m_KHAH;
case a_f_SEEN: return a_m_SEEN;
case a_f_SHEEN: return a_m_SHEEN;
case a_f_SAD: return a_m_SAD;
case a_f_DAD: return a_m_DAD;
case a_f_TAH: return a_m_TAH;
case a_f_ZAH: return a_m_ZAH;
case a_f_AIN: return a_m_AIN;
case a_f_GHAIN: return a_m_GHAIN;
case a_f_FEH: return a_m_FEH;
case a_f_QAF: return a_m_QAF;
case a_f_KAF: return a_m_KAF;
case a_f_LAM: return a_m_LAM;
case a_f_MEEM: return a_m_MEEM;
case a_f_NOON: return a_m_NOON;
case a_f_HEH: return a_m_HEH;
case a_f_YEH: return a_m_YEH;
return tempc;
/* NOTE: these encodings are multi-positional, no ?
* case a_f_LAM_ALEF_MADDA_ABOVE:
* case a_f_LAM_ALEF_HAMZA_ABOVE:
* case a_f_LAM_ALEF_HAMZA_BELOW:
* case a_f_LAM_ALEF:
*/
}
return 0;
}
@@ -702,27 +516,14 @@ chg_c_f2m(int cur_c)
static int
chg_c_laa2i(int hid_c)
{
int tempc;
switch (hid_c)
{
case a_ALEF_MADDA:
tempc = a_s_LAM_ALEF_MADDA_ABOVE;
break;
case a_ALEF_HAMZA_ABOVE:
tempc = a_s_LAM_ALEF_HAMZA_ABOVE;
break;
case a_ALEF_HAMZA_BELOW:
tempc = a_s_LAM_ALEF_HAMZA_BELOW;
break;
case a_ALEF:
tempc = a_s_LAM_ALEF;
break;
default:
tempc = 0;
case a_ALEF_MADDA: return a_s_LAM_ALEF_MADDA_ABOVE;
case a_ALEF_HAMZA_ABOVE: return a_s_LAM_ALEF_HAMZA_ABOVE;
case a_ALEF_HAMZA_BELOW: return a_s_LAM_ALEF_HAMZA_BELOW;
case a_ALEF: return a_s_LAM_ALEF;
}
return tempc;
return 0;
}
@@ -732,27 +533,14 @@ chg_c_laa2i(int hid_c)
static int
chg_c_laa2f(int hid_c)
{
int tempc;
switch (hid_c)
{
case a_ALEF_MADDA:
tempc = a_f_LAM_ALEF_MADDA_ABOVE;
break;
case a_ALEF_HAMZA_ABOVE:
tempc = a_f_LAM_ALEF_HAMZA_ABOVE;
break;
case a_ALEF_HAMZA_BELOW:
tempc = a_f_LAM_ALEF_HAMZA_BELOW;
break;
case a_ALEF:
tempc = a_f_LAM_ALEF;
break;
default:
tempc = 0;
case a_ALEF_MADDA: return a_f_LAM_ALEF_MADDA_ABOVE;
case a_ALEF_HAMZA_ABOVE: return a_f_LAM_ALEF_HAMZA_ABOVE;
case a_ALEF_HAMZA_BELOW: return a_f_LAM_ALEF_HAMZA_BELOW;
case a_ALEF: return a_f_LAM_ALEF;
}
return tempc;
return 0;
}
/*

View File

@@ -58,6 +58,9 @@ static void f_asin(typval_T *argvars, typval_T *rettv);
static void f_atan(typval_T *argvars, typval_T *rettv);
static void f_atan2(typval_T *argvars, typval_T *rettv);
#endif
#ifdef FEAT_BEVAL
static void f_balloon_show(typval_T *argvars, typval_T *rettv);
#endif
static void f_browse(typval_T *argvars, typval_T *rettv);
static void f_browsedir(typval_T *argvars, typval_T *rettv);
static void f_bufexists(typval_T *argvars, typval_T *rettv);
@@ -483,6 +486,9 @@ static struct fst
#ifdef FEAT_FLOAT
{"atan", 1, 1, f_atan},
{"atan2", 2, 2, f_atan2},
#endif
#ifdef FEAT_BEVAL
{"balloon_show", 1, 1, f_balloon_show},
#endif
{"browse", 4, 4, f_browse},
{"browsedir", 2, 2, f_browsedir},
@@ -1362,6 +1368,18 @@ f_atan2(typval_T *argvars, typval_T *rettv)
}
#endif
/*
* "balloon_show()" function
*/
#ifdef FEAT_BEVAL
static void
f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED)
{
if (balloonEval != NULL)
gui_mch_post_balloon(balloonEval, get_tv_string_chk(&argvars[0]));
}
#endif
/*
* "browse(save, title, initdir, default)" function
*/

View File

@@ -4216,6 +4216,11 @@ set_context_in_map_cmd(
arg = skipwhite(arg + 8);
continue;
}
if (STRNCMP(arg, "<special>", 9) == 0)
{
arg = skipwhite(arg + 9);
continue;
}
#ifdef FEAT_EVAL
if (STRNCMP(arg, "<script>", 8) == 0)
{
@@ -4267,7 +4272,7 @@ ExpandMappings(
{
count = 0;
for (i = 0; i < 6; ++i)
for (i = 0; i < 7; ++i)
{
if (i == 0)
p = (char_u *)"<silent>";
@@ -4285,6 +4290,8 @@ ExpandMappings(
#endif
else if (i == 5)
p = (char_u *)"<nowait>";
else if (i == 6)
p = (char_u *)"<special>";
else
continue;

View File

@@ -57,6 +57,9 @@ static void main_start_gui(void);
# if defined(HAS_SWAP_EXISTS_ACTION)
static void check_swap_exists_action(void);
# endif
# ifdef FEAT_EVAL
static void set_progpath(char_u *argv0);
# endif
# if defined(FEAT_CLIENTSERVER) || defined(PROTO)
static void exec_on_server(mparm_T *parmp);
static void prepare_server(mparm_T *parmp);
@@ -1694,7 +1697,7 @@ parse_command_name(mparm_T *parmp)
#ifdef FEAT_EVAL
set_vim_var_string(VV_PROGNAME, initstr, -1);
set_vim_var_string(VV_PROGPATH, (char_u *)parmp->argv[0], -1);
set_progpath((char_u *)parmp->argv[0]);
#endif
if (TOLOWER_ASC(initstr[0]) == 'r')
@@ -3417,7 +3420,7 @@ check_swap_exists_action(void)
}
#endif
#endif
#endif /* NO_VIM_MAIN */
#if defined(STARTUPTIME) || defined(PROTO)
static void time_diff(struct timeval *then, struct timeval *now);
@@ -3525,6 +3528,30 @@ time_msg(
#endif
#ifndef NO_VIM_MAIN
static void
set_progpath(char_u *argv0)
{
char_u *val = argv0;
char_u buf[MAXPATHL];
/* A relative path containing a "/" will become invalid when using ":cd",
* turn it into a full path.
* On MS-Windows "vim.exe" is found in the current directory, thus also do
* it when there is no path and the file exists. */
if ( !mch_isFullName(argv0)
# ifdef WIN32
&& mch_can_exe(argv0, NULL, TRUE)
# else
&& gettail(argv0) != argv0
# endif
&& vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
val = buf;
set_vim_var_string(VV_PROGPATH, val, -1);
}
#endif /* NO_VIM_MAIN */
#if (defined(FEAT_CLIENTSERVER) && !defined(NO_VIM_MAIN)) || defined(PROTO)
/*

View File

@@ -539,7 +539,7 @@ emsg_not_now(void)
return FALSE;
}
#ifdef FEAT_EVAL
#if defined(FEAT_EVAL) || defined(PROTO)
static garray_T ignore_error_list = GA_EMPTY;
void
@@ -605,7 +605,8 @@ emsg(char_u *s)
#ifdef FEAT_EVAL
/* When testing some errors are turned into a normal message. */
if (ignore_error(s))
return msg(s);
/* don't call msg() if it results in a dialog */
return msg_use_printf() ? FALSE : msg(s);
#endif
called_emsg = TRUE;

View File

@@ -2099,7 +2099,7 @@ ga_concat_strings(garray_T *gap, char *sep)
return s;
}
#if defined(FEAT_VIMINFO) || defined(PROTO)
#if defined(FEAT_VIMINFO) || defined(FEAT_EVAL) || defined(PROTO)
/*
* Make a copy of string "p" and add it to "gap".
* When out of memory nothing changes.

View File

@@ -467,6 +467,12 @@ mch_inchar(
if ((wait_time < 0 || wait_time > 100L) && channel_any_readahead())
wait_time = 10L;
#endif
#ifdef FEAT_BEVAL
if (p_beval && wait_time > 100L)
/* The 'balloonexpr' may indirectly invoke a callback while waiting
* for a character, need to check often. */
wait_time = 100L;
#endif
/*
* We want to be interrupted by the winch signal

View File

@@ -1467,6 +1467,12 @@ WaitForChar(long msec)
dwWaitTime = 10;
}
#endif
#ifdef FEAT_BEVAL
if (p_beval && dwWaitTime > 100)
/* The 'balloonexpr' may indirectly invoke a callback while
* waiting for a character, need to check often. */
dwWaitTime = 100;
#endif
#ifdef FEAT_MZSCHEME
if (mzthreads_allowed() && p_mzq > 0
&& (msec < 0 || (long)dwWaitTime > p_mzq))

View File

@@ -1693,12 +1693,9 @@ searchc(cmdarg_T *cap, int t_cmd)
if (p[col] == c && stop)
break;
}
else
{
if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0
else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0
&& stop)
break;
}
break;
stop = TRUE;
}
}

View File

@@ -27,3 +27,6 @@ endfunc
func GUITearDownCommon()
call delete('Xhome', 'rf')
endfunc
" Ignore the "failed to create input context" error.
call test_ignore_error('E285')

View File

@@ -192,6 +192,7 @@ func RunVimPiped(before, after, arguments, pipecmd)
if cmd !~ '-u NONE'
let cmd = cmd . ' -u NONE'
endif
let cmd .= ' --not-a-term'
" With pipecmd we can't set VIMRUNTIME.
if a:pipecmd != ''

View File

@@ -25,6 +25,26 @@ func Test_complete_wildmenu()
set nowildmenu
endfunc
func Test_map_completion()
if !has('cmdline_compl')
return
endif
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <unique> <silent>', getreg(':'))
call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <script> <unique>', getreg(':'))
call feedkeys(":map <expr> <sc\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <expr> <script>', getreg(':'))
call feedkeys(":map <buffer> <e\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <buffer> <expr>', getreg(':'))
call feedkeys(":map <nowait> <b\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <nowait> <buffer>', getreg(':'))
call feedkeys(":map <special> <no\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <special> <nowait>', getreg(':'))
call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <silent> <special>', getreg(':'))
endfunc
func Test_match_completion()
if !has('cmdline_compl')
return

View File

@@ -100,15 +100,20 @@ func Test_manual_fold_with_filter()
if !executable('cat')
return
endif
new
call setline(1, range(1, 20))
4,$fold
%foldopen
10,$fold
%foldopen
" This filter command should not have an effect
1,8! cat
call feedkeys('5ggzdzMGdd', 'xt')
call assert_equal(['1', '2', '3', '4', '5', '6', '7', '8', '9'], getline(1, '$'))
bwipe!
for type in ['manual', 'marker']
exe 'set foldmethod=' . type
new
call setline(1, range(1, 20))
4,$fold
%foldopen
10,$fold
%foldopen
" This filter command should not have an effect
1,8! cat
call feedkeys('5ggzdzMGdd', 'xt')
call assert_equal(['1', '2', '3', '4', '5', '6', '7', '8', '9'], getline(1, '$'))
bwipe!
set foldmethod&
endfor
endfunc

View File

@@ -466,3 +466,10 @@ func Test_getbufvar()
set fileformats&
endfunc
func Test_balloon_show()
if has('balloon_eval')
" This won't do anything but must not crash either.
call balloon_show('hi!')
endif
endfunc

View File

@@ -17,9 +17,6 @@ endfunc
" Test for resetting "secure" flag after GUI has started.
" Must be run first.
func Test_1_set_secure()
" Ignore the "failed to create input context" error.
call test_ignore_error('E285')
set exrc secure
gui -f
call assert_equal(1, has('gui_running'))
@@ -87,8 +84,12 @@ func Test_quoteplus()
let test_response = 'Yes, I can.'
let vim_exe = exepath(v:progpath)
let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
\ . vim_exe . ' -f -g -u NONE -U NONE --noplugin -c ''%s'''
let cmd = 'call feedkeys("'
\ . vim_exe
\ . ' -u NONE -U NONE --noplugin --not-a-term -c ''%s'''
" Ignore the "failed to create input context" error.
let cmd = 'call test_ignore_error("E285") | '
\ . 'gui -f | '
\ . 'call feedkeys("'
\ . '\"+p'
\ . ':s/' . test_call . '/' . test_response . '/\<CR>'
\ . '\"+yis'

View File

@@ -15,7 +15,10 @@ func TearDown()
call GUITearDownCommon()
endfunc
" Make sure that the tests will be done with the GUI activated.
" Ignore the "failed to create input context" error.
call test_ignore_error('E285')
" Start the GUI now, in the foreground.
gui -f
func Test_set_guiheadroom()

View File

@@ -128,6 +128,14 @@ func XlistTests(cchar)
let l = split(result, "\n")
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
" Test for '+'
redir => result
Xlist! +2
redir END
let l = split(result, "\n")
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
endfunc
func Test_clist()
@@ -925,6 +933,11 @@ func Test_efm2()
\ "(67,3) warning: 's' already defined"
\]
set efm=%+P[%f],(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%-Q
" To exercise the push/pop file functionality in quickfix, the test files
" need to be created.
call writefile(['Line1'], 'Xtestfile1')
call writefile(['Line2'], 'Xtestfile2')
call writefile(['Line3'], 'Xtestfile3')
cexpr ""
for l in lines
caddexpr l
@@ -935,6 +948,9 @@ func Test_efm2()
call assert_equal(2, l[2].col)
call assert_equal('w', l[2].type)
call assert_equal('e', l[3].type)
call delete('Xtestfile1')
call delete('Xtestfile2')
call delete('Xtestfile3')
" Tests for %E, %C and %Z format specifiers
let lines = ["Error 275",
@@ -1369,11 +1385,25 @@ func Test_switchbuf()
call assert_equal(2, winnr('$'))
call assert_equal(1, bufwinnr('Xqftestfile3'))
" If only quickfix window is open in the current tabpage, jumping to an
" entry with 'switchubf' set to 'usetab' should search in other tabpages.
enew | only
set switchbuf=usetab
tabedit Xqftestfile1
tabedit Xqftestfile2
tabedit Xqftestfile3
tabfirst
copen | only
clast
call assert_equal(4, tabpagenr())
tabfirst | tabonly | enew | only
call delete('Xqftestfile1')
call delete('Xqftestfile2')
call delete('Xqftestfile3')
set switchbuf&vim
enew | only
endfunc
func Xadjust_qflnum(cchar)
@@ -1691,3 +1721,56 @@ func Test_dirstack_cleanup()
caddbuffer
let &efm = save_efm
endfunc
" Tests for jumping to entries from the location list window and quickfix
" window
func Test_cwindow_jump()
set efm=%f%%%l%%%m
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen | only
lfirst
call assert_true(winnr('$') == 2)
call assert_true(winnr() == 1)
" Location list for the new window should be set
call assert_true(getloclist(0)[2].text == 'Line 30')
" Open a scratch buffer
" Open a new window and create a location list
" Open the location list window and close the other window
" Jump to an entry.
" Should create a new window and jump to the entry. The scrtach buffer
" should not be used.
enew | only
set buftype=nofile
below new
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen
2wincmd c
lnext
call assert_true(winnr('$') == 3)
call assert_true(winnr() == 2)
" Open two windows with two different location lists
" Open the location list window and close the previous window
" Jump to an entry in the location list window
" Should open the file in the first window and not set the location list.
enew | only
lgetexpr ["F1%5%Line 5"]
below new
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen
2wincmd c
lnext
call assert_true(winnr() == 1)
call assert_true(getloclist(0)[0].text == 'Line 5')
enew | only
cgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
copen
cnext
call assert_true(winnr('$') == 2)
call assert_true(winnr() == 1)
enew | only
set efm&vim
endfunc

View File

@@ -294,3 +294,10 @@ func Test_searchpair()
q!
endfunc
func Test_searchc()
" These commands used to cause memory overflow in searchc().
new
norm ixx
exe "norm 0t\u93cf"
bw!
endfunc

View File

@@ -183,3 +183,17 @@ func Test_read_stdin()
endif
call delete('Xtestout')
endfunc
func Test_progpath()
" Tests normally run with "./vim" or "../vim", these must have been expanded
" to a full path.
if has('unix')
call assert_equal('/', v:progpath[0])
elseif has('win32')
call assert_equal(':', v:progpath[1])
call assert_match('[/\\]', v:progpath[2])
endif
" Only expect "vim" to appear in v:progname.
call assert_match('vim\c', v:progname)
endfunc

View File

@@ -764,6 +764,32 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
407,
/**/
406,
/**/
405,
/**/
404,
/**/
403,
/**/
402,
/**/
401,
/**/
400,
/**/
399,
/**/
398,
/**/
397,
/**/
396,
/**/
395,
/**/
394,
/**/