Skip to content

Commit 7574495

Browse files
committed
Merge branch 'vim'
2 parents 0f3e96b + 25bd5e5 commit 7574495

File tree

9 files changed

+66
-18
lines changed

9 files changed

+66
-18
lines changed

.hgtags

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,3 +2739,9 @@ bb358cc41d920983629ace62bcf26decbf06cab4 v7-4-010
27392739
9801d06e7b4ccdcd02cf40bee34eaaada0ca0409 v7-4-014
27402740
a7478f9f2551e95bff138cd658f7a86ced804ab1 v7-4-015
27412741
8d5cd0ec3e7183a289f9bac41d3981307cdc1fac v7-4-016
2742+
c47c8cd5fe5c014c141d9fb3fa8935b268436a4e v7-4-017
2743+
460d5be9395ef3e05f4b1397ea98a5b54d825fc5 v7-4-018
2744+
d5eb32dc231cd870c562e7b0be96fa994b505d9f v7-4-019
2745+
c1ae5baa41f47bbf96be81e0158707a88af48b34 v7-4-020
2746+
c514693882b9f1c7be2e76a0307926df799da3ea v7-4-021
2747+
965044860b7f4884657fcaa042853238c7b13e69 v7-4-022

src/edit.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,6 @@ ins_compl_new_leader()
34773477
}
34783478

34793479
compl_enter_selects = !compl_used_match;
3480-
compl_shown_match = compl_curr_match = compl_first_match;
34813480

34823481
/* Show the popup menu with a different set of matches. */
34833482
ins_compl_show_pum();
@@ -5199,8 +5198,14 @@ ins_complete(c)
51995198
}
52005199
else if (ctrl_x_mode == CTRL_X_FILES)
52015200
{
5202-
while (--startcol >= 0 && vim_isfilec(line[startcol]))
5203-
;
5201+
char_u *p = line + startcol;
5202+
5203+
/* Go back to just before the first filename character. */
5204+
mb_ptr_back(line, p);
5205+
while (vim_isfilec(PTR2CHAR(p)) && p >= line)
5206+
mb_ptr_back(line, p);
5207+
startcol = p - line;
5208+
52045209
compl_col += ++startcol;
52055210
compl_length = (int)curs_col - startcol;
52065211
compl_pattern = addstar(line + compl_col, compl_length,

src/misc1.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9180,6 +9180,8 @@ prepare_to_exit()
91809180
/*
91819181
* Preserve files and exit.
91829182
* When called IObuff must contain a message.
9183+
* NOTE: This may be called from deathtrap() in a signal handler, avoid unsafe
9184+
* functions, such as allocating memory.
91839185
*/
91849186
void
91859187
preserve_exit()
@@ -9202,7 +9204,7 @@ preserve_exit()
92029204
{
92039205
if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
92049206
{
9205-
OUT_STR(_("Vim: preserving files...\n"));
9207+
OUT_STR("Vim: preserving files...\n");
92069208
screen_start(); /* don't know where cursor is now */
92079209
out_flush();
92089210
ml_sync_all(FALSE, FALSE); /* preserve all swap files */
@@ -9212,7 +9214,7 @@ preserve_exit()
92129214

92139215
ml_close_all(FALSE); /* close all memfiles, without deleting */
92149216

9215-
OUT_STR(_("Vim: Finished.\n"));
9217+
OUT_STR("Vim: Finished.\n");
92169218

92179219
getout(1);
92189220
}

src/os_unix.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,10 @@ mch_didjmp()
957957

958958
/*
959959
* This function handles deadly signals.
960-
* It tries to preserve any swap file and exit properly.
960+
* It tries to preserve any swap files and exit properly.
961961
* (partly from Elvis).
962+
* NOTE: Avoid unsafe functions, such as allocating memory, they can result in
963+
* a deadlock.
962964
*/
963965
static RETSIGTYPE
964966
deathtrap SIGDEFARG(sigarg)
@@ -1090,18 +1092,23 @@ deathtrap SIGDEFARG(sigarg)
10901092
}
10911093
if (entered == 2)
10921094
{
1093-
OUT_STR(_("Vim: Double signal, exiting\n"));
1095+
/* No translation, it may call malloc(). */
1096+
OUT_STR("Vim: Double signal, exiting\n");
10941097
out_flush();
10951098
getout(1);
10961099
}
10971100

1101+
/* No translation, it may call malloc(). */
10981102
#ifdef SIGHASARG
1099-
sprintf((char *)IObuff, _("Vim: Caught deadly signal %s\n"),
1103+
sprintf((char *)IObuff, "Vim: Caught deadly signal %s\n",
11001104
signal_info[i].name);
11011105
#else
1102-
sprintf((char *)IObuff, _("Vim: Caught deadly signal\n"));
1106+
sprintf((char *)IObuff, "Vim: Caught deadly signal\n");
11031107
#endif
1104-
preserve_exit(); /* preserve files and exit */
1108+
1109+
/* Preserve files and exit. This sets the really_exiting flag to prevent
1110+
* calling free(). */
1111+
preserve_exit();
11051112

11061113
#ifdef NBDEBUG
11071114
reset_signals();

src/regexp_nfa.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4209,10 +4209,11 @@ addstate(l, state, subs_arg, pim, off)
42094209
break;
42104210

42114211
case NFA_MCLOSE:
4212-
if (nfa_has_zend)
4212+
if (nfa_has_zend && (REG_MULTI
4213+
? subs->norm.list.multi[0].end.lnum >= 0
4214+
: subs->norm.list.line[0].end != NULL))
42134215
{
4214-
/* Do not overwrite the position set by \ze. If no \ze
4215-
* encountered end will be set in nfa_regtry(). */
4216+
/* Do not overwrite the position set by \ze. */
42164217
subs = addstate(l, state->out, subs, pim, off);
42174218
break;
42184219
}
@@ -5322,7 +5323,10 @@ nfa_regmatch(prog, start, submatch, m)
53225323
log_subsexpr(m);
53235324
#endif
53245325
nfa_match = TRUE;
5325-
break;
5326+
/* See comment above at "goto nextchar". */
5327+
if (nextlist->n == 0)
5328+
clen = 0;
5329+
goto nextchar;
53265330

53275331
case NFA_START_INVISIBLE:
53285332
case NFA_START_INVISIBLE_FIRST:

src/tag.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,13 +1797,16 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname)
17971797
*/
17981798
if (state == TS_START)
17991799
{
1800-
/* The header ends when the line sorts below "!_TAG_".
1801-
* There may be non-header items before the header though,
1802-
* e.g. "!" itself. When case is folded lower case letters
1803-
* sort before "_". */
1800+
/* The header ends when the line sorts below "!_TAG_". When
1801+
* case is folded lower case letters sort before "_". */
18041802
if (STRNCMP(lbuf, "!_TAG_", 6) <= 0
18051803
|| (lbuf[0] == '!' && ASCII_ISLOWER(lbuf[1])))
18061804
{
1805+
if (STRNCMP(lbuf, "!_TAG_", 6) != 0)
1806+
/* Non-header item before the header, e.g. "!" itself.
1807+
*/
1808+
goto parse_line;
1809+
18071810
/*
18081811
* Read header line.
18091812
*/
@@ -1898,6 +1901,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname)
18981901
#endif
18991902
}
19001903

1904+
parse_line:
19011905
/*
19021906
* Figure out where the different strings are in this line.
19031907
* For "normal" tags: Do a quick check if the tag matches.

src/testdir/test64.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ STARTTEST
328328
:call add(tl, [2, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
329329
:call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
330330
:call add(tl, [2, '\>\zs.', 'aword. ', '.'])
331+
:call add(tl, [2, '\s\+\ze\[/\|\s\zs\s\+', 'is [a t', ' '])
331332
:"
332333
:"""" Tests for \@= and \& features
333334
:call add(tl, [2, 'abc\@=', 'abc', 'ab'])
@@ -427,6 +428,7 @@ STARTTEST
427428
:""""" \@>
428429
:call add(tl, [2, '\(a*\)\@>a', 'aaaa'])
429430
:call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa'])
431+
:call add(tl, [2, '^\(.\{-}b\)\@>.', ' abcbd', ' abc', ' ab'])
430432
:" TODO: BT engine does not restore submatch after failure
431433
:call add(tl, [1, '\(a*\)\@>a\|a\+', 'aaaa', 'aaaa'])
432434
:"

src/testdir/test64.ok

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,9 @@ OK 2 - \v(a \zsif .*){2}
752752
OK 0 - \>\zs.
753753
OK 1 - \>\zs.
754754
OK 2 - \>\zs.
755+
OK 0 - \s\+\ze\[/\|\s\zs\s\+
756+
OK 1 - \s\+\ze\[/\|\s\zs\s\+
757+
OK 2 - \s\+\ze\[/\|\s\zs\s\+
755758
OK 0 - abc\@=
756759
OK 1 - abc\@=
757760
OK 2 - abc\@=
@@ -983,6 +986,9 @@ OK 2 - \(a*\)\@>a
983986
OK 0 - \(a*\)\@>b
984987
OK 1 - \(a*\)\@>b
985988
OK 2 - \(a*\)\@>b
989+
OK 0 - ^\(.\{-}b\)\@>.
990+
OK 1 - ^\(.\{-}b\)\@>.
991+
OK 2 - ^\(.\{-}b\)\@>.
986992
OK 0 - \(a*\)\@>a\|a\+
987993
OK 2 - \(a*\)\@>a\|a\+
988994
OK 0 - \_[^8-9]\+

src/version.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,18 @@ static char *(features[]) =
753753

754754
static int included_patches[] =
755755
{ /* Add new patch number below this line */
756+
/**/
757+
22,
758+
/**/
759+
21,
760+
/**/
761+
20,
762+
/**/
763+
19,
764+
/**/
765+
18,
766+
/**/
767+
17,
756768
/**/
757769
16,
758770
/**/

0 commit comments

Comments
 (0)