Skip to content

Commit bc5505e

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents b521a36 + cf5fdf7 commit bc5505e

20 files changed

+190
-26
lines changed

runtime/doc/eval.txt

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,19 +1981,20 @@ argidx() Number current index in the argument list
19811981
arglistid([{winnr} [, {tabnr}]]) Number argument list id
19821982
argv({nr}) String {nr} entry of the argument list
19831983
argv() List the argument list
1984-
assert_equal({exp}, {act} [, {msg}]) none assert {exp} is equal to {act}
1985-
assert_exception({error} [, {msg}]) none assert {error} is in v:exception
1986-
assert_fails({cmd} [, {error}]) none assert {cmd} fails
1987-
assert_false({actual} [, {msg}]) none assert {actual} is false
1984+
assert_equal({exp}, {act} [, {msg}]) none assert {exp} is equal to {act}
1985+
assert_exception({error} [, {msg}]) none assert {error} is in v:exception
1986+
assert_fails({cmd} [, {error}]) none assert {cmd} fails
1987+
assert_false({actual} [, {msg}]) none assert {actual} is false
19881988
assert_inrange({lower}, {upper}, {actual} [, {msg}])
19891989
none assert {actual} is inside the range
1990-
assert_match({pat}, {text} [, {msg}]) none assert {pat} matches {text}
1990+
assert_match({pat}, {text} [, {msg}]) none assert {pat} matches {text}
19911991
assert_notequal({exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
19921992
assert_notmatch({pat}, {text} [, {msg}]) none assert {pat} not matches {text}
1993-
assert_true({actual} [, {msg}]) none assert {actual} is true
1993+
assert_true({actual} [, {msg}]) none assert {actual} is true
19941994
asin({expr}) Float arc sine of {expr}
19951995
atan({expr}) Float arc tangent of {expr}
19961996
atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2}
1997+
balloon_show({msg}) none show {msg} inside the balloon
19971998
browse({save}, {title}, {initdir}, {default})
19981999
String put up a file requester
19992000
browsedir({title}, {initdir}) String put up a directory requester
@@ -2619,6 +2620,25 @@ atan2({expr1}, {expr2}) *atan2()*
26192620
< 2.356194
26202621
{only available when compiled with the |+float| feature}
26212622

2623+
balloon_show({msg}) *balloon_show()*
2624+
Show {msg} inside the balloon.
2625+
Example: >
2626+
func GetBalloonContent()
2627+
" initiate getting the content
2628+
return ''
2629+
endfunc
2630+
set balloonexpr=GetBalloonContent()
2631+
2632+
func BalloonCallback(result)
2633+
call balloon_show(a:result)
2634+
endfunc
2635+
<
2636+
The intended use is that fetching the content of the balloon
2637+
is initiated from 'balloonexpr'. It will invoke an
2638+
asynchronous method, in which a callback invokes
2639+
balloon_show(). The 'balloonexpr' itself can return an
2640+
empty string or a placeholder.
2641+
{only available when compiled with the +beval feature}
26222642

26232643
*browse()*
26242644
browse({save}, {title}, {initdir}, {default})

src/evalfunc.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ static void f_asin(typval_T *argvars, typval_T *rettv);
5858
static void f_atan(typval_T *argvars, typval_T *rettv);
5959
static void f_atan2(typval_T *argvars, typval_T *rettv);
6060
#endif
61+
#ifdef FEAT_BEVAL
62+
static void f_balloon_show(typval_T *argvars, typval_T *rettv);
63+
#endif
6164
static void f_browse(typval_T *argvars, typval_T *rettv);
6265
static void f_browsedir(typval_T *argvars, typval_T *rettv);
6366
static void f_bufexists(typval_T *argvars, typval_T *rettv);
@@ -483,6 +486,9 @@ static struct fst
483486
#ifdef FEAT_FLOAT
484487
{"atan", 1, 1, f_atan},
485488
{"atan2", 2, 2, f_atan2},
489+
#endif
490+
#ifdef FEAT_BEVAL
491+
{"balloon_show", 1, 1, f_balloon_show},
486492
#endif
487493
{"browse", 4, 4, f_browse},
488494
{"browsedir", 2, 2, f_browsedir},
@@ -1362,6 +1368,18 @@ f_atan2(typval_T *argvars, typval_T *rettv)
13621368
}
13631369
#endif
13641370

1371+
/*
1372+
* "balloon_show()" function
1373+
*/
1374+
#ifdef FEAT_BEVAL
1375+
static void
1376+
f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED)
1377+
{
1378+
if (balloonEval != NULL)
1379+
gui_mch_post_balloon(balloonEval, get_tv_string_chk(&argvars[0]));
1380+
}
1381+
#endif
1382+
13651383
/*
13661384
* "browse(save, title, initdir, default)" function
13671385
*/

src/ex_docmd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9831,6 +9831,7 @@ ex_redraw(exarg_T *eap)
98319831

98329832
RedrawingDisabled = 0;
98339833
p_lz = FALSE;
9834+
validate_cursor();
98349835
update_topline();
98359836
update_screen(eap->forceit ? CLEAR : VIsual_active ? INVERTED : 0);
98369837
#ifdef FEAT_TITLE

src/getchar.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4216,6 +4216,11 @@ set_context_in_map_cmd(
42164216
arg = skipwhite(arg + 8);
42174217
continue;
42184218
}
4219+
if (STRNCMP(arg, "<special>", 9) == 0)
4220+
{
4221+
arg = skipwhite(arg + 9);
4222+
continue;
4223+
}
42194224
#ifdef FEAT_EVAL
42204225
if (STRNCMP(arg, "<script>", 8) == 0)
42214226
{
@@ -4267,7 +4272,7 @@ ExpandMappings(
42674272
{
42684273
count = 0;
42694274

4270-
for (i = 0; i < 6; ++i)
4275+
for (i = 0; i < 7; ++i)
42714276
{
42724277
if (i == 0)
42734278
p = (char_u *)"<silent>";
@@ -4285,6 +4290,8 @@ ExpandMappings(
42854290
#endif
42864291
else if (i == 5)
42874292
p = (char_u *)"<nowait>";
4293+
else if (i == 6)
4294+
p = (char_u *)"<special>";
42884295
else
42894296
continue;
42904297

src/message.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ emsg_not_now(void)
539539
return FALSE;
540540
}
541541

542-
#ifdef FEAT_EVAL
542+
#if defined(FEAT_EVAL) || defined(PROTO)
543543
static garray_T ignore_error_list = GA_EMPTY;
544544

545545
void
@@ -605,7 +605,8 @@ emsg(char_u *s)
605605
#ifdef FEAT_EVAL
606606
/* When testing some errors are turned into a normal message. */
607607
if (ignore_error(s))
608-
return msg(s);
608+
/* don't call msg() if it results in a dialog */
609+
return msg_use_printf() ? FALSE : msg(s);
609610
#endif
610611

611612
called_emsg = TRUE;

src/misc2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ ga_concat_strings(garray_T *gap, char *sep)
20992099
return s;
21002100
}
21012101

2102-
#if defined(FEAT_VIMINFO) || defined(PROTO)
2102+
#if defined(FEAT_VIMINFO) || defined(FEAT_EVAL) || defined(PROTO)
21032103
/*
21042104
* Make a copy of string "p" and add it to "gap".
21052105
* When out of memory nothing changes.

src/os_unix.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,12 @@ mch_inchar(
467467
if ((wait_time < 0 || wait_time > 100L) && channel_any_readahead())
468468
wait_time = 10L;
469469
#endif
470+
#ifdef FEAT_BEVAL
471+
if (p_beval && wait_time > 100L)
472+
/* The 'balloonexpr' may indirectly invoke a callback while waiting
473+
* for a character, need to check often. */
474+
wait_time = 100L;
475+
#endif
470476

471477
/*
472478
* We want to be interrupted by the winch signal

src/os_win32.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,12 @@ WaitForChar(long msec)
14671467
dwWaitTime = 10;
14681468
}
14691469
#endif
1470+
#ifdef FEAT_BEVAL
1471+
if (p_beval && dwWaitTime > 100)
1472+
/* The 'balloonexpr' may indirectly invoke a callback while
1473+
* waiting for a character, need to check often. */
1474+
dwWaitTime = 100;
1475+
#endif
14701476
#ifdef FEAT_MZSCHEME
14711477
if (mzthreads_allowed() && p_mzq > 0
14721478
&& (msec < 0 || (long)dwWaitTime > p_mzq))

src/screen.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3429,10 +3429,13 @@ win_line(
34293429
#else
34303430
--ptr;
34313431
#endif
3432+
/* If the character fits on the screen, don't need to skip it.
3433+
* Except for a TAB. */
3434+
if ((
34323435
#ifdef FEAT_MBYTE
3433-
/* character fits on the screen, don't need to skip it */
3434-
if ((*mb_ptr2cells)(ptr) >= c && col == 0)
3436+
(*mb_ptr2cells)(ptr) >= c ||
34353437
#endif
3438+
*ptr == TAB) && col == 0)
34363439
n_skip = v - vcol;
34373440
}
34383441

src/search.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,12 +1702,9 @@ searchc(cmdarg_T *cap, int t_cmd)
17021702
if (p[col] == c && stop)
17031703
break;
17041704
}
1705-
else
1706-
{
1707-
if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0
1705+
else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0
17081706
&& stop)
1709-
break;
1710-
}
1707+
break;
17111708
stop = TRUE;
17121709
}
17131710
}

0 commit comments

Comments
 (0)