Skip to content

Commit 45dd264

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents b7e7ad9 + cd030c4 commit 45dd264

41 files changed

Lines changed: 293 additions & 81 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,7 +2158,7 @@ buflist_new(
21582158
if (top_file_num < 0) // wrap around (may cause duplicates)
21592159
{
21602160
emsg(_("W14: Warning: List of file names overflow"));
2161-
if (emsg_silent == 0)
2161+
if (emsg_silent == 0 && !in_assert_fails)
21622162
{
21632163
out_flush();
21642164
ui_delay(3001L, TRUE); // make sure it is noticed

src/change.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ changed(void)
115115
// Wait two seconds, to make sure the user reads this unexpected
116116
// message. Since we could be anywhere, call wait_return() now,
117117
// and don't let the emsg() set msg_scroll.
118-
if (need_wait_return && emsg_silent == 0)
118+
if (need_wait_return && emsg_silent == 0 && !in_assert_fails)
119119
{
120120
out_flush();
121121
ui_delay(2002L, TRUE);

src/errors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ EXTERN char e_assert_fails_second_arg[]
2727
INIT(= N_("E856: \"assert_fails()\" second argument must be a string or a list with one or two strings"));
2828
EXTERN char e_cannot_index_special_variable[]
2929
INIT(= N_("E909: Cannot index a special variable"));
30-
EXTERN char e_missing_let_str[]
31-
INIT(= N_("E1100: Missing :let: %s"));
30+
EXTERN char e_missing_var_str[]
31+
INIT(= N_("E1100: Missing :var: %s"));
3232
EXTERN char e_variable_not_found_str[]
3333
INIT(= N_("E1001: Variable not found: %s"));
3434
EXTERN char e_syntax_error_at_str[]

src/eval.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,18 +474,21 @@ skip_expr_concatenate(
474474
* Return pointer to allocated memory, or NULL for failure.
475475
*/
476476
char_u *
477-
eval_to_string(
477+
eval_to_string_eap(
478478
char_u *arg,
479-
int convert)
479+
int convert,
480+
exarg_T *eap)
480481
{
481482
typval_T tv;
482483
char_u *retval;
483484
garray_T ga;
484485
#ifdef FEAT_FLOAT
485486
char_u numbuf[NUMBUFLEN];
486487
#endif
488+
evalarg_T evalarg;
487489

488-
if (eval0(arg, &tv, NULL, &EVALARG_EVALUATE) == FAIL)
490+
fill_evalarg_from_eap(&evalarg, eap, eap != NULL && eap->skip);
491+
if (eval0(arg, &tv, NULL, &evalarg) == FAIL)
489492
retval = NULL;
490493
else
491494
{
@@ -512,11 +515,19 @@ eval_to_string(
512515
retval = vim_strsave(tv_get_string(&tv));
513516
clear_tv(&tv);
514517
}
515-
clear_evalarg(&EVALARG_EVALUATE, NULL);
518+
clear_evalarg(&evalarg, NULL);
516519

517520
return retval;
518521
}
519522

523+
char_u *
524+
eval_to_string(
525+
char_u *arg,
526+
int convert)
527+
{
528+
return eval_to_string_eap(arg, convert, NULL);
529+
}
530+
520531
/*
521532
* Call eval_to_string() without using current local variables and using
522533
* textwinlock. When "use_sandbox" is TRUE use the sandbox.

src/ex_docmd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,7 @@ do_one_cmd(
17251725
#ifdef FEAT_EVAL
17261726
int may_have_range;
17271727
int vim9script = in_vim9script();
1728+
int did_set_expr_line = FALSE;
17281729
#endif
17291730

17301731
CLEAR_FIELD(ea);
@@ -2321,8 +2322,9 @@ do_one_cmd(
23212322
// for '=' register: accept the rest of the line as an expression
23222323
if (ea.arg[-1] == '=' && ea.arg[0] != NUL)
23232324
{
2324-
set_expr_line(vim_strsave(ea.arg));
2325+
set_expr_line(vim_strsave(ea.arg), &ea);
23252326
ea.arg += STRLEN(ea.arg);
2327+
did_set_expr_line = TRUE;
23262328
}
23272329
#endif
23282330
ea.arg = skipwhite(ea.arg);
@@ -2601,6 +2603,9 @@ do_one_cmd(
26012603
do_errthrow(cstack,
26022604
(ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx))
26032605
? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
2606+
2607+
if (did_set_expr_line)
2608+
set_expr_line(NULL, NULL);
26042609
#endif
26052610

26062611
undo_cmdmod(&cmdmod);
@@ -2764,7 +2769,7 @@ parse_command_modifiers(
27642769
}
27652770
#ifdef FEAT_EVAL
27662771
// Avoid that "filter(arg)" is recognized.
2767-
if (in_vim9script() && !VIM_ISWHITE(*p))
2772+
if (in_vim9script() && !VIM_ISWHITE(p[-1]))
27682773
break;
27692774
#endif
27702775
if (skip_only)

src/fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4243,7 +4243,7 @@ buf_check_timestamp(
42434243
msg_puts_attr(mesg2, HL_ATTR(HLF_W) + MSG_HIST);
42444244
msg_clr_eos();
42454245
(void)msg_end();
4246-
if (emsg_silent == 0)
4246+
if (emsg_silent == 0 && !in_assert_fails)
42474247
{
42484248
out_flush();
42494249
#ifdef FEAT_GUI

src/globals.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ EXTERN int emsg_skip INIT(= 0); // don't display errors for
221221
EXTERN int emsg_severe INIT(= FALSE); // use message of next of several
222222
// emsg() calls for throw
223223
// used by assert_fails()
224-
EXTERN int emsg_assert_fails_used INIT(= FALSE);
225224
EXTERN char_u *emsg_assert_fails_msg INIT(= NULL);
226225
EXTERN long emsg_assert_fails_lnum INIT(= 0);
227226
EXTERN char_u *emsg_assert_fails_context INIT(= NULL);
@@ -1132,6 +1131,8 @@ EXTERN int emsg_silent INIT(= 0); // don't print error messages
11321131
EXTERN int emsg_noredir INIT(= 0); // don't redirect error messages
11331132
EXTERN int cmd_silent INIT(= FALSE); // don't echo the command line
11341133

1134+
EXTERN int in_assert_fails INIT(= FALSE); // assert_fails() active
1135+
11351136
EXTERN int swap_exists_action INIT(= SEA_NONE);
11361137
// For dialog when swap file already
11371138
// exists.
@@ -1703,7 +1704,7 @@ EXTERN char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob"));
17031704
EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s"));
17041705
EXTERN char e_toofewarg[] INIT(= N_("E119: Not enough arguments for function: %s"));
17051706
EXTERN char e_func_deleted[] INIT(= N_("E933: Function was deleted: %s"));
1706-
EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s"));
1707+
EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
17071708
EXTERN char e_listreq[] INIT(= N_("E714: List required"));
17081709
EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required"));
17091710
EXTERN char e_list_end[] INIT(= N_("E697: Missing end of List ']': %s"));

src/gui_gtk_x11.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4726,9 +4726,10 @@ gui_mch_adjust_charheight(void)
47264726

47274727
pango_font_metrics_unref(metrics);
47284728

4729-
// Round up, but not when the value is very close (e.g. 15.0009).
4730-
gui.char_height = (ascent + descent + PANGO_SCALE - 3) / PANGO_SCALE
4731-
+ p_linespace;
4729+
// Round up when the value is more than about 1/16 of a pixel above a whole
4730+
// pixel (12.0624 becomes 12, 12.07 becomes 13). Then add 'linespace'.
4731+
gui.char_height = (ascent + descent + (PANGO_SCALE * 15) / 16)
4732+
/ PANGO_SCALE + p_linespace;
47324733
// LINTED: avoid warning: bitwise operation on signed value
47334734
gui.char_ascent = PANGO_PIXELS(ascent + p_linespace * PANGO_SCALE / 2);
47344735

src/gui_w32.c

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,6 +2985,42 @@ gui_mch_flash(int msec)
29852985
InvertRect(s_hdc, &rc);
29862986
}
29872987

2988+
/*
2989+
* Check if the specified point is on-screen. (multi-monitor aware)
2990+
*/
2991+
static BOOL
2992+
is_point_onscreen(int x, int y)
2993+
{
2994+
POINT pt = {x, y};
2995+
2996+
return MonitorFromPoint(pt, MONITOR_DEFAULTTONULL) != NULL;
2997+
}
2998+
2999+
/*
3000+
* Check if the whole area of the specified window is on-screen.
3001+
*
3002+
* Note about DirectX: Windows 10 1809 or above no longer maintains image of
3003+
* the window portion that is off-screen. Scrolling by DWriteContext_Scroll()
3004+
* only works when the whole window is on-screen.
3005+
*/
3006+
static BOOL
3007+
is_window_onscreen(HWND hwnd)
3008+
{
3009+
RECT rc;
3010+
3011+
GetWindowRect(hwnd, &rc);
3012+
3013+
if (!is_point_onscreen(rc.left, rc.top))
3014+
return FALSE;
3015+
if (!is_point_onscreen(rc.left, rc.bottom))
3016+
return FALSE;
3017+
if (!is_point_onscreen(rc.right, rc.top))
3018+
return FALSE;
3019+
if (!is_point_onscreen(rc.right, rc.bottom))
3020+
return FALSE;
3021+
return TRUE;
3022+
}
3023+
29883024
/*
29893025
* Return flags used for scrolling.
29903026
* The SW_INVALIDATE is required when part of the window is covered or
@@ -2996,15 +3032,12 @@ get_scroll_flags(void)
29963032
HWND hwnd;
29973033
RECT rcVim, rcOther, rcDest;
29983034

2999-
GetWindowRect(s_hwnd, &rcVim);
3000-
3001-
// Check if the window is partly above or below the screen. We don't care
3002-
// about partly left or right of the screen, it is not relevant when
3003-
// scrolling up or down.
3004-
if (rcVim.top < 0 || rcVim.bottom > GetSystemMetrics(SM_CYFULLSCREEN))
3035+
// Check if the window is (partly) off-screen.
3036+
if (!is_window_onscreen(s_hwnd))
30053037
return SW_INVALIDATE;
30063038

30073039
// Check if there is an window (partly) on top of us.
3040+
GetWindowRect(s_hwnd, &rcVim);
30083041
for (hwnd = s_hwnd; (hwnd = GetWindow(hwnd, GW_HWNDPREV)) != (HWND)0; )
30093042
if (IsWindowVisible(hwnd))
30103043
{
@@ -3046,14 +3079,17 @@ gui_mch_delete_lines(
30463079
rc.bottom = FILL_Y(gui.scroll_region_bot + 1);
30473080

30483081
#if defined(FEAT_DIRECTX)
3049-
if (IS_ENABLE_DIRECTX())
3082+
if (IS_ENABLE_DIRECTX() && is_window_onscreen(s_hwnd))
30503083
{
30513084
DWriteContext_Scroll(s_dwc, 0, -num_lines * gui.char_height, &rc);
3052-
DWriteContext_Flush(s_dwc);
30533085
}
30543086
else
30553087
#endif
30563088
{
3089+
#if defined(FEAT_DIRECTX)
3090+
if (IS_ENABLE_DIRECTX())
3091+
DWriteContext_Flush(s_dwc);
3092+
#endif
30573093
intel_gpu_workaround();
30583094
ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height,
30593095
&rc, &rc, NULL, NULL, get_scroll_flags());
@@ -3088,14 +3124,17 @@ gui_mch_insert_lines(
30883124
rc.bottom = FILL_Y(gui.scroll_region_bot + 1);
30893125

30903126
#if defined(FEAT_DIRECTX)
3091-
if (IS_ENABLE_DIRECTX())
3127+
if (IS_ENABLE_DIRECTX() && is_window_onscreen(s_hwnd))
30923128
{
30933129
DWriteContext_Scroll(s_dwc, 0, num_lines * gui.char_height, &rc);
3094-
DWriteContext_Flush(s_dwc);
30953130
}
30963131
else
30973132
#endif
30983133
{
3134+
#if defined(FEAT_DIRECTX)
3135+
if (IS_ENABLE_DIRECTX())
3136+
DWriteContext_Flush(s_dwc);
3137+
#endif
30993138
intel_gpu_workaround();
31003139
// The SW_INVALIDATE is required when part of the window is covered or
31013140
// off-screen. How do we avoid it when it's not needed?

src/insexpand.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ has_compl_option(int dict_opt)
298298
msg_attr(dict_opt ? _("'dictionary' option is empty")
299299
: _("'thesaurus' option is empty"),
300300
HL_ATTR(HLF_E));
301-
if (emsg_silent == 0)
301+
if (emsg_silent == 0 && !in_assert_fails)
302302
{
303303
vim_beep(BO_COMPL);
304304
setcursor();
@@ -4072,10 +4072,11 @@ ins_complete(int c, int enable_pum)
40724072
}
40734073
else
40744074
{
4075+
#if defined(FEAT_COMPL_FUNC) || defined(FEAT_EVAL)
40754076
// Update completion sequence number when needed.
40764077
if (compl_curr_match->cp_number == -1)
40774078
ins_compl_update_sequence_numbers();
4078-
4079+
#endif
40794080
// The match should always have a sequence number now, this is
40804081
// just a safety check.
40814082
if (compl_curr_match->cp_number != -1)

0 commit comments

Comments
 (0)