Skip to content

Commit 4be190e

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 8b2dcf4 + 0664089 commit 4be190e

24 files changed

Lines changed: 927 additions & 714 deletions

runtime/doc/mlang.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ Or:
102102

103103
This also contains tools xgettext, msgformat and others.
104104

105-
libintl.dll should be placed in same directory with (g)vim.exe, or some
106-
place where PATH environment value describe. Vim also finds libintl-8.dll.
105+
libintl.dll should be placed in same directory as (g)vim.exe, or one of the
106+
directories listed in the PATH environment value. Vim also looks for the
107+
alternate names "libintl-8.dll" and "intl.dll".
108+
107109
Message files (vim.mo) have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES",
108110
where "xx" is the abbreviation of the language (mostly two letters).
109111

src/diff.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2848,18 +2848,19 @@ ex_diffgetput(exarg_T *eap)
28482848
theend:
28492849
diff_busy = FALSE;
28502850
if (diff_need_update)
2851-
{
2852-
diff_need_update = FALSE;
28532851
ex_diffupdate(NULL);
2854-
}
2852+
2853+
// Check that the cursor is on a valid character and update it's
2854+
// position. When there were filler lines the topline has become
2855+
// invalid.
2856+
check_cursor();
2857+
changed_line_abv_curs();
2858+
2859+
if (diff_need_update)
2860+
// redraw already done by ex_diffupdate()
2861+
diff_need_update = FALSE;
28552862
else
28562863
{
2857-
// Check that the cursor is on a valid character and update it's
2858-
// position. When there were filler lines the topline has become
2859-
// invalid.
2860-
check_cursor();
2861-
changed_line_abv_curs();
2862-
28632864
// Also need to redraw the other buffers.
28642865
diff_redraw(FALSE);
28652866
apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);

src/eval.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9041,6 +9041,8 @@ assert_fails(typval_T *argvars)
90419041
char_u *cmd = get_tv_string_chk(&argvars[0]);
90429042
garray_T ga;
90439043
int ret = 0;
9044+
char_u numbuf[NUMBUFLEN];
9045+
char_u *tofree;
90449046

90459047
called_emsg = FALSE;
90469048
suppress_errthrow = TRUE;
@@ -9050,7 +9052,14 @@ assert_fails(typval_T *argvars)
90509052
{
90519053
prepare_assert_error(&ga);
90529054
ga_concat(&ga, (char_u *)"command did not fail: ");
9053-
ga_concat(&ga, cmd);
9055+
if (argvars[1].v_type != VAR_UNKNOWN
9056+
&& argvars[2].v_type != VAR_UNKNOWN)
9057+
{
9058+
ga_concat(&ga, echo_string(&argvars[2], &tofree, numbuf, 0));
9059+
vim_free(tofree);
9060+
}
9061+
else
9062+
ga_concat(&ga, cmd);
90549063
assert_error(&ga);
90559064
ga_clear(&ga);
90569065
ret = 1;

src/evalfunc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ static struct fst
512512
{"assert_equal", 2, 3, f_assert_equal},
513513
{"assert_equalfile", 2, 2, f_assert_equalfile},
514514
{"assert_exception", 1, 2, f_assert_exception},
515-
{"assert_fails", 1, 2, f_assert_fails},
515+
{"assert_fails", 1, 3, f_assert_fails},
516516
{"assert_false", 1, 2, f_assert_false},
517517
{"assert_inrange", 3, 4, f_assert_inrange},
518518
{"assert_match", 2, 3, f_assert_match},
@@ -1507,7 +1507,7 @@ f_assert_exception(typval_T *argvars, typval_T *rettv)
15071507
}
15081508

15091509
/*
1510-
* "assert_fails(cmd [, error])" function
1510+
* "assert_fails(cmd [, error[, msg]])" function
15111511
*/
15121512
static void
15131513
f_assert_fails(typval_T *argvars, typval_T *rettv)

src/ex_cmds.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,26 @@ do_shell(
16761676
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf);
16771677
}
16781678

1679+
#if !defined(UNIX)
1680+
static char_u *
1681+
find_pipe(char_u *cmd)
1682+
{
1683+
char_u *p;
1684+
int inquote = FALSE;
1685+
1686+
for (p = cmd; *p != NUL; ++p)
1687+
{
1688+
if (!inquote && *p == '|')
1689+
return p;
1690+
if (*p == '"')
1691+
inquote = !inquote;
1692+
else if (rem_backslash(p))
1693+
++p;
1694+
}
1695+
return NULL;
1696+
}
1697+
#endif
1698+
16791699
/*
16801700
* Create a shell command from a command string, input redirection file and
16811701
* output redirection file.
@@ -1746,15 +1766,15 @@ make_filter_cmd(
17461766
*/
17471767
if (*p_shq == NUL)
17481768
{
1749-
p = vim_strchr(buf, '|');
1769+
p = find_pipe(buf);
17501770
if (p != NULL)
17511771
*p = NUL;
17521772
}
17531773
STRCAT(buf, " <"); /* " < " causes problems on Amiga */
17541774
STRCAT(buf, itmp);
17551775
if (*p_shq == NUL)
17561776
{
1757-
p = vim_strchr(cmd, '|');
1777+
p = find_pipe(cmd);
17581778
if (p != NULL)
17591779
{
17601780
STRCAT(buf, " "); /* insert a space before the '|' for DOS */

src/getchar.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -438,23 +438,29 @@ typeahead_noflush(int c)
438438
* flush all typeahead characters (used when interrupted by a CTRL-C).
439439
*/
440440
void
441-
flush_buffers(int flush_typeahead)
441+
flush_buffers(flush_buffers_T flush_typeahead)
442442
{
443443
init_typebuf();
444444

445445
start_stuff();
446446
while (read_readbuffers(TRUE) != NUL)
447447
;
448448

449-
if (flush_typeahead) /* remove all typeahead */
449+
if (flush_typeahead == FLUSH_MINIMAL)
450450
{
451-
/*
452-
* We have to get all characters, because we may delete the first part
453-
* of an escape sequence.
454-
* In an xterm we get one char at a time and we have to get them all.
455-
*/
456-
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0)
457-
;
451+
// remove mapped characters at the start only
452+
typebuf.tb_off += typebuf.tb_maplen;
453+
typebuf.tb_len -= typebuf.tb_maplen;
454+
}
455+
else
456+
{
457+
// remove typeahead
458+
if (flush_typeahead == FLUSH_INPUT)
459+
// We have to get all characters, because we may delete the first
460+
// part of an escape sequence. In an xterm we get one char at a
461+
// time and we have to get them all.
462+
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0)
463+
;
458464
typebuf.tb_off = MAXMAPLEN;
459465
typebuf.tb_len = 0;
460466
#if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
@@ -463,11 +469,6 @@ flush_buffers(int flush_typeahead)
463469
typebuf_was_filled = FALSE;
464470
#endif
465471
}
466-
else /* remove mapped characters at the start only */
467-
{
468-
typebuf.tb_off += typebuf.tb_maplen;
469-
typebuf.tb_len -= typebuf.tb_maplen;
470-
}
471472
typebuf.tb_maplen = 0;
472473
typebuf.tb_silent = 0;
473474
cmd_silent = FALSE;
@@ -1858,6 +1859,7 @@ plain_vgetc(void)
18581859
* Check if a character is available, such that vgetc() will not block.
18591860
* If the next character is a special character or multi-byte, the returned
18601861
* character is not valid!.
1862+
* Returns NUL if no character is available.
18611863
*/
18621864
int
18631865
vpeekc(void)
@@ -1956,7 +1958,8 @@ vungetc(int c)
19561958
* KeyTyped is set to TRUE in the case the user typed the key.
19571959
* KeyStuffed is TRUE if the character comes from the stuff buffer.
19581960
* if "advance" is FALSE (vpeekc()):
1959-
* just look whether there is a character available.
1961+
* Just look whether there is a character available.
1962+
* Return NUL if not.
19601963
*
19611964
* When "no_mapping" is zero, checks for mappings in the current mode.
19621965
* Only returns one byte (of a multi-byte character).
@@ -2084,7 +2087,7 @@ vgetorpeek(int advance)
20842087
c = ESC;
20852088
else
20862089
c = Ctrl_C;
2087-
flush_buffers(TRUE); /* flush all typeahead */
2090+
flush_buffers(FLUSH_INPUT); // flush all typeahead
20882091

20892092
if (advance)
20902093
{
@@ -2510,7 +2513,7 @@ vgetorpeek(int advance)
25102513
redrawcmdline();
25112514
else
25122515
setcursor();
2513-
flush_buffers(FALSE);
2516+
flush_buffers(FLUSH_MINIMAL);
25142517
mapdepth = 0; /* for next one */
25152518
c = -1;
25162519
break;

src/memline.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4506,19 +4506,23 @@ findswapname(
45064506
#endif
45074507
{
45084508
#ifdef FEAT_GUI
4509-
/* If we are supposed to start the GUI but it wasn't
4510-
* completely started yet, start it now. This makes
4511-
* the messages displayed in the Vim window when
4512-
* loading a session from the .gvimrc file. */
4509+
// If we are supposed to start the GUI but it wasn't
4510+
// completely started yet, start it now. This makes
4511+
// the messages displayed in the Vim window when
4512+
// loading a session from the .gvimrc file.
45134513
if (gui.starting && !gui.in_use)
45144514
gui_start();
45154515
#endif
4516-
/* Show info about the existing swap file. */
4516+
// Show info about the existing swap file.
45174517
attention_message(buf, fname);
45184518

4519-
/* We don't want a 'q' typed at the more-prompt
4520-
* interrupt loading a file. */
4519+
// We don't want a 'q' typed at the more-prompt
4520+
// interrupt loading a file.
45214521
got_int = FALSE;
4522+
4523+
// If vimrc has "simalt ~x" we don't want it to
4524+
// interfere with the prompt here.
4525+
flush_buffers(FLUSH_TYPEAHEAD);
45224526
}
45234527

45244528
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)

src/message.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,8 @@ emsg(char_u *s)
688688
if (p_eb)
689689
beep_flush(); /* also includes flush_buffers() */
690690
else
691-
flush_buffers(FALSE); /* flush internal buffers */
692-
did_emsg = TRUE; /* flag for DoOneCmd() */
691+
flush_buffers(FLUSH_MINIMAL); // flush internal buffers
692+
did_emsg = TRUE; // flag for DoOneCmd()
693693
#ifdef FEAT_EVAL
694694
did_uncaught_emsg = TRUE;
695695
#endif

src/misc1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3832,7 +3832,7 @@ beep_flush(void)
38323832
{
38333833
if (emsg_silent == 0)
38343834
{
3835-
flush_buffers(FALSE);
3835+
flush_buffers(FLUSH_MINIMAL);
38363836
vim_beep(BO_ERROR);
38373837
}
38383838
}

src/misc2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6470,14 +6470,14 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
64706470
while (*p != NUL && (inquote || (*p != ' ' && *p != TAB)))
64716471
{
64726472
if (p[0] == '"')
6473-
/* quotes surrounding an argument and are dropped */
6473+
// quotes surrounding an argument and are dropped
64746474
inquote = !inquote;
64756475
else
64766476
{
6477-
if (p[0] == '\\' && p[1] != NUL)
6477+
if (rem_backslash(p))
64786478
{
6479-
/* First pass: skip over "\ " and "\"".
6480-
* Second pass: Remove the backslash. */
6479+
// First pass: skip over "\ " and "\"".
6480+
// Second pass: Remove the backslash.
64816481
++p;
64826482
}
64836483
if (i == 1)

0 commit comments

Comments
 (0)