Skip to content

Commit ac70910

Browse files
committed
Merge branch 'vim' of git://github.com/b4winckler/macvim into kaoriya
2 parents a49a03b + 25bd5e5 commit ac70910

File tree

19 files changed

+640
-130
lines changed

19 files changed

+640
-130
lines changed

.hgtags

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,3 +2729,25 @@ ba37e955913e85700677b89a720c6e5fc8d23cc3 v7-4b-016
27292729
059c8a4b103f6971276435127c7ad970a81b0b2c v7-4b-021
27302730
d5d6b78cff090e87d52924179e44131b5ba7436d v7-4b-022
27312731
359743c1f59af353454dd80a26d9f8c20ae6ee8e v7-4
2732+
3e9107b86b68d83bfa94e43afffbf17623afe55e v7-4-001
2733+
e29f11399ccec9215cc8cfab1f9307dea0567d70 v7-4-002
2734+
560a6a2329503d483db019a88cacc3307e5c30b7 v7-4-003
2735+
f6247eaf4e1d556f782321890d725663f74babe6 v7-4-004
2736+
3640cf4c0d4b6e5687bb7a31678fab70c88ed94b v7-4-005
2737+
2374a05efe20287d55bd824689a41becc7662505 v7-4-006
2738+
4fe1dfc7014e57b4beb5a01c9e94357265d19a92 v7-4-007
2739+
b04bdb2c5fce70a278d26c477debb65a388da0ca v7-4-008
2740+
8b5d80861c5e0403ea9f54ddddce2752a463c8a5 v7-4-009
2741+
bb358cc41d920983629ace62bcf26decbf06cab4 v7-4-010
2742+
54e66395831c1a58b4a9804e7884e505842157e8 v7-4-011
2743+
8e28c23e482c5b3c8296d8022271822886793456 v7-4-012
2744+
07737d3aa81725672796cbc9a010d63414ab6fea v7-4-013
2745+
9801d06e7b4ccdcd02cf40bee34eaaada0ca0409 v7-4-014
2746+
a7478f9f2551e95bff138cd658f7a86ced804ab1 v7-4-015
2747+
8d5cd0ec3e7183a289f9bac41d3981307cdc1fac v7-4-016
2748+
c47c8cd5fe5c014c141d9fb3fa8935b268436a4e v7-4-017
2749+
460d5be9395ef3e05f4b1397ea98a5b54d825fc5 v7-4-018
2750+
d5eb32dc231cd870c562e7b0be96fa994b505d9f v7-4-019
2751+
c1ae5baa41f47bbf96be81e0158707a88af48b34 v7-4-020
2752+
c514693882b9f1c7be2e76a0307926df799da3ea v7-4-021
2753+
965044860b7f4884657fcaa042853238c7b13e69 v7-4-022

src/buffer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,10 @@ do_buffer(action, start, dir, count, forceit)
12111211
&& !(curwin->w_closing || curwin->w_buffer->b_closing)
12121212
# endif
12131213
&& (firstwin != lastwin || first_tabpage->tp_next != NULL))
1214-
win_close(curwin, FALSE);
1214+
{
1215+
if (win_close(curwin, FALSE) == FAIL)
1216+
break;
1217+
}
12151218
#endif
12161219

12171220
/*

src/edit.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3467,7 +3467,6 @@ ins_compl_new_leader()
34673467
}
34683468

34693469
compl_enter_selects = !compl_used_match;
3470-
compl_shown_match = compl_curr_match = compl_first_match;
34713470

34723471
/* Show the popup menu with a different set of matches. */
34733472
ins_compl_show_pum();
@@ -5184,8 +5183,14 @@ ins_complete(c)
51845183
}
51855184
else if (ctrl_x_mode == CTRL_X_FILES)
51865185
{
5187-
while (--startcol >= 0 && vim_isfilec(line[startcol]))
5188-
;
5186+
char_u *p = line + startcol;
5187+
5188+
/* Go back to just before the first filename character. */
5189+
mb_ptr_back(line, p);
5190+
while (vim_isfilec(PTR2CHAR(p)) && p >= line)
5191+
mb_ptr_back(line, p);
5192+
startcol = p - line;
5193+
51895194
compl_col += ++startcol;
51905195
compl_length = (int)curs_col - startcol;
51915196
compl_pattern = addstar(line + compl_col, compl_length,

src/eval.c

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12137,6 +12137,9 @@ f_has(argvars, rettv)
1213712137
#ifndef CASE_INSENSITIVE_FILENAME
1213812138
"fname_case",
1213912139
#endif
12140+
#ifdef HAVE_ACL
12141+
"acl",
12142+
#endif
1214012143
#ifdef FEAT_ARABIC
1214112144
"arabic",
1214212145
#endif
@@ -12550,7 +12553,12 @@ f_has(argvars, rettv)
1255012553
"xfontset",
1255112554
#endif
1255212555
#ifdef FEAT_XPM_W32
12553-
"xpm_w32",
12556+
"xpm",
12557+
"xpm_w32", /* for backward compatibility */
12558+
#else
12559+
# if defined(HAVE_XPM)
12560+
"xpm",
12561+
# endif
1255412562
#endif
1255512563
#ifdef USE_XSMP
1255612564
"xsmp",
@@ -14326,14 +14334,23 @@ f_mkdir(argvars, rettv)
1432614334
return;
1432714335

1432814336
dir = get_tv_string_buf(&argvars[0], buf);
14329-
if (argvars[1].v_type != VAR_UNKNOWN)
14337+
if (*dir == NUL)
14338+
rettv->vval.v_number = FAIL;
14339+
else
1433014340
{
14331-
if (argvars[2].v_type != VAR_UNKNOWN)
14332-
prot = get_tv_number_chk(&argvars[2], NULL);
14333-
if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
14334-
mkdir_recurse(dir, prot);
14341+
if (*gettail(dir) == NUL)
14342+
/* remove trailing slashes */
14343+
*gettail_sep(dir) = NUL;
14344+
14345+
if (argvars[1].v_type != VAR_UNKNOWN)
14346+
{
14347+
if (argvars[2].v_type != VAR_UNKNOWN)
14348+
prot = get_tv_number_chk(&argvars[2], NULL);
14349+
if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
14350+
mkdir_recurse(dir, prot);
14351+
}
14352+
rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
1433514353
}
14336-
rettv->vval.v_number = prot != -1 ? vim_mkdir_emsg(dir, prot) : 0;
1433714354
}
1433814355
#endif
1433914356

src/fileio.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -666,13 +666,13 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
666666
}
667667
}
668668

669-
#ifdef UNIX
670-
/*
671-
* On Unix it is possible to read a directory, so we have to
672-
* check for it before the mch_open().
673-
*/
674669
if (!read_stdin && !read_buffer)
675670
{
671+
#ifdef UNIX
672+
/*
673+
* On Unix it is possible to read a directory, so we have to
674+
* check for it before the mch_open().
675+
*/
676676
perm = mch_getperm(fname);
677677
if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */
678678
# ifdef S_ISFIFO
@@ -695,8 +695,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
695695
msg_scroll = msg_save;
696696
return FAIL;
697697
}
698-
699-
# if defined(MSDOS) || defined(MSWIN) || defined(OS2)
698+
#endif
699+
#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
700700
/*
701701
* MS-Windows allows opening a device, but we will probably get stuck
702702
* trying to read it.
@@ -708,9 +708,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
708708
msg_scroll = msg_save;
709709
return FAIL;
710710
}
711-
# endif
712-
}
713711
#endif
712+
}
714713

715714
/* Set default or forced 'fileformat' and 'binary'. */
716715
set_file_options(set_options, eap);
@@ -3173,9 +3172,14 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
31733172
int *did_ask; /* flag: whether already asked for key */
31743173
{
31753174
int method = crypt_method_from_magic((char *)ptr, *sizep);
3175+
int b_p_ro = curbuf->b_p_ro;
31763176

31773177
if (method >= 0)
31783178
{
3179+
/* Mark the buffer as read-only until the decryption has taken place.
3180+
* Avoids accidentally overwriting the file with garbage. */
3181+
curbuf->b_p_ro = TRUE;
3182+
31793183
set_crypt_method(curbuf, method);
31803184
if (method > 0)
31813185
(void)blowfish_self_test();
@@ -3224,6 +3228,8 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
32243228
*sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len;
32253229
mch_memmove(ptr, ptr + CRYPT_MAGIC_LEN + salt_len + seed_len,
32263230
(size_t)*sizep);
3231+
/* Restore the read-only flag. */
3232+
curbuf->b_p_ro = b_p_ro;
32273233
}
32283234
}
32293235
/* When starting to edit a new file which does not have encryption, clear

src/main.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,6 +2730,7 @@ edit_buffers(parmp)
27302730
int arg_idx; /* index in argument list */
27312731
int i;
27322732
int advance = TRUE;
2733+
win_T *win;
27332734

27342735
# ifdef FEAT_AUTOCMD
27352736
/*
@@ -2819,24 +2820,22 @@ edit_buffers(parmp)
28192820
# ifdef FEAT_AUTOCMD
28202821
--autocmd_no_enter;
28212822
# endif
2823+
2824+
/* make the first window the current window */
2825+
win = firstwin;
28222826
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
2823-
/*
2824-
* Avoid making a preview window the current window.
2825-
*/
2826-
if (firstwin->w_p_pvw)
2827+
/* Avoid making a preview window the current window. */
2828+
while (win->w_p_pvw)
28272829
{
2828-
win_T *win;
2829-
2830-
for (win = firstwin; win != NULL; win = win->w_next)
2831-
if (!win->w_p_pvw)
2832-
{
2833-
firstwin = win;
2834-
break;
2835-
}
2830+
win = win->w_next;
2831+
if (win == NULL)
2832+
{
2833+
win = firstwin;
2834+
break;
2835+
}
28362836
}
28372837
#endif
2838-
/* make the first window the current window */
2839-
win_enter(firstwin, FALSE);
2838+
win_enter(win, FALSE);
28402839

28412840
# ifdef FEAT_AUTOCMD
28422841
--autocmd_no_leave;

src/misc1.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9174,6 +9174,8 @@ prepare_to_exit()
91749174
/*
91759175
* Preserve files and exit.
91769176
* When called IObuff must contain a message.
9177+
* NOTE: This may be called from deathtrap() in a signal handler, avoid unsafe
9178+
* functions, such as allocating memory.
91779179
*/
91789180
void
91799181
preserve_exit()
@@ -9196,7 +9198,7 @@ preserve_exit()
91969198
{
91979199
if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
91989200
{
9199-
OUT_STR(_("Vim: preserving files...\n"));
9201+
OUT_STR("Vim: preserving files...\n");
92009202
screen_start(); /* don't know where cursor is now */
92019203
out_flush();
92029204
ml_sync_all(FALSE, FALSE); /* preserve all swap files */
@@ -9206,7 +9208,7 @@ preserve_exit()
92069208

92079209
ml_close_all(FALSE); /* close all memfiles, without deleting */
92089210

9209-
OUT_STR(_("Vim: Finished.\n"));
9211+
OUT_STR("Vim: Finished.\n");
92109212

92119213
getout(1);
92129214
}

0 commit comments

Comments
 (0)