Skip to content

Commit 43ac38d

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 831e48f + abbc448 commit 43ac38d

File tree

8 files changed

+83
-10
lines changed

8 files changed

+83
-10
lines changed

src/ex_getln.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,10 @@ getcmdline(
18021802
goto cmdline_not_changed;
18031803
#endif
18041804

1805+
case K_PS:
1806+
bracketed_paste(PASTE_CMDLINE, FALSE, NULL);
1807+
goto cmdline_changed;
1808+
18051809
default:
18061810
#ifdef UNIX
18071811
if (c == intr_char)
@@ -2374,8 +2378,7 @@ getexmodeline(
23742378
if (ga_grow(&line_ga, 40) == FAIL)
23752379
break;
23762380

2377-
/* Get one character at a time. Don't use inchar(), it can't handle
2378-
* special characters. */
2381+
/* Get one character at a time. */
23792382
prev_char = c1;
23802383
c1 = vgetc();
23812384

@@ -2390,6 +2393,12 @@ getexmodeline(
23902393
break;
23912394
}
23922395

2396+
if (c1 == K_PS)
2397+
{
2398+
bracketed_paste(PASTE_EX, FALSE, &line_ga);
2399+
goto redraw;
2400+
}
2401+
23932402
if (!escaped)
23942403
{
23952404
/* CR typed means "enter", which is NL */

src/fileio.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ readfile(
274274
int msg_save = msg_scroll;
275275
linenr_T read_no_eol_lnum = 0; /* non-zero lnum when last line of
276276
* last read was missing the eol */
277-
int try_mac = (vim_strchr(p_ffs, 'm') != NULL);
278-
int try_dos = (vim_strchr(p_ffs, 'd') != NULL);
279-
int try_unix = (vim_strchr(p_ffs, 'x') != NULL);
277+
int try_mac;
278+
int try_dos;
279+
int try_unix;
280280
int file_rewind = FALSE;
281281
#ifdef FEAT_MBYTE
282282
int can_retry;
@@ -738,6 +738,10 @@ readfile(
738738
curbuf->b_op_start.lnum = ((from == 0) ? 1 : from);
739739
curbuf->b_op_start.col = 0;
740740

741+
try_mac = (vim_strchr(p_ffs, 'm') != NULL);
742+
try_dos = (vim_strchr(p_ffs, 'd') != NULL);
743+
try_unix = (vim_strchr(p_ffs, 'x') != NULL);
744+
741745
#ifdef FEAT_AUTOCMD
742746
if (!read_buffer)
743747
{
@@ -769,6 +773,11 @@ readfile(
769773
else
770774
apply_autocmds_exarg(EVENT_FILEREADPRE, sfname, sfname,
771775
FALSE, NULL, eap);
776+
/* autocommands may have changed it */
777+
try_mac = (vim_strchr(p_ffs, 'm') != NULL);
778+
try_dos = (vim_strchr(p_ffs, 'd') != NULL);
779+
try_unix = (vim_strchr(p_ffs, 'x') != NULL);
780+
772781
if (msg_scrolled == n)
773782
msg_scroll = m;
774783

@@ -2242,8 +2251,9 @@ readfile(
22422251
len = (colnr_T)(ptr - line_start + 1);
22432252
if (fileformat == EOL_DOS)
22442253
{
2245-
if (ptr[-1] == CAR) /* remove CR */
2254+
if (ptr > line_start && ptr[-1] == CAR)
22462255
{
2256+
/* remove CR before NL */
22472257
ptr[-1] = NUL;
22482258
--len;
22492259
}

src/ops.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3774,6 +3774,11 @@ do_put(
37743774
*/
37753775
if (y_type == MCHAR && y_size == 1)
37763776
{
3777+
linenr_T end = curbuf->b_visual.vi_end.lnum;
3778+
3779+
if (curbuf->b_visual.vi_end.lnum < curbuf->b_visual.vi_start.lnum)
3780+
end = curbuf->b_visual.vi_start.lnum;
3781+
37773782
do {
37783783
totlen = count * yanklen;
37793784
if (totlen > 0)
@@ -3801,7 +3806,7 @@ do_put(
38013806
}
38023807
if (VIsual_active)
38033808
lnum++;
3804-
} while (VIsual_active && lnum <= curbuf->b_visual.vi_end.lnum);
3809+
} while (VIsual_active && lnum <= end);
38053810

38063811
if (VIsual_active) /* reset lnum to the last visual line */
38073812
lnum--;

src/tag.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,7 @@ prepare_pats(pat_T *pats, int has_re)
12561256
* TAG_REGEXP use "pat" as a regexp
12571257
* TAG_NOIC don't always ignore case
12581258
* TAG_KEEP_LANG keep language
1259+
* TAG_CSCOPE use cscope results for tags
12591260
*/
12601261
int
12611262
find_tags(
@@ -1423,6 +1424,14 @@ find_tags(
14231424
*/
14241425
if (help_only) /* want tags from help file */
14251426
curbuf->b_help = TRUE; /* will be restored later */
1427+
#ifdef FEAT_CSCOPE
1428+
else if (use_cscope)
1429+
{
1430+
/* Make sure we don't mix help and cscope, confuses Coverity. */
1431+
help_only = FALSE;
1432+
curbuf->b_help = FALSE;
1433+
}
1434+
#endif
14261435

14271436
orgpat.len = (int)STRLEN(pat);
14281437
#ifdef FEAT_MULTI_LANG
@@ -2281,7 +2290,8 @@ find_tags(
22812290
*/
22822291
*tagp.tagname_end = NUL;
22832292
len = (int)(tagp.tagname_end - tagp.tagname);
2284-
mfp = (char_u *)alloc((int)sizeof(char_u) + len + 10 + ML_EXTRA + 1);
2293+
mfp = (char_u *)alloc((int)sizeof(char_u)
2294+
+ len + 10 + ML_EXTRA + 1);
22852295
if (mfp != NULL)
22862296
{
22872297
int heuristic;

src/term.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,7 +3154,7 @@ starttermcap(void)
31543154
{
31553155
out_str(T_TI); /* start termcap mode */
31563156
out_str(T_KS); /* start "keypad transmit" mode */
3157-
out_str(T_BE); /* enable bracketed paste moe */
3157+
out_str(T_BE); /* enable bracketed paste mode */
31583158
out_flush();
31593159
termcap_active = TRUE;
31603160
screen_start(); /* don't know where cursor is now */
@@ -3204,7 +3204,7 @@ stoptermcap(void)
32043204
check_for_codes_from_term();
32053205
}
32063206
#endif
3207-
out_str(T_BD); /* disable bracketed paste moe */
3207+
out_str(T_BD); /* disable bracketed paste mode */
32083208
out_str(T_KE); /* stop "keypad transmit" mode */
32093209
out_flush();
32103210
termcap_active = FALSE;

src/testdir/test_fileformat.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,19 @@ func Test_fileformat_after_bw()
1515
call assert_equal(test_fileformats, &fileformat)
1616
set fileformats&
1717
endfunc
18+
19+
func Test_fileformat_autocommand()
20+
let filecnt = ["", "foobar\<CR>", "eins\<CR>", "\<CR>", "zwei\<CR>", "drei", "vier", "fünf", ""]
21+
let ffs = &ffs
22+
call writefile(filecnt, 'Xfile', 'b')
23+
au BufReadPre Xfile set ffs=dos ff=dos
24+
new Xfile
25+
call assert_equal('dos', &l:ff)
26+
call assert_equal('dos', &ffs)
27+
28+
" cleanup
29+
call delete('Xfile')
30+
let &ffs = ffs
31+
au! BufReadPre Xfile
32+
bw!
33+
endfunc

src/testdir/test_put.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,14 @@ func Test_put_block()
1010
call assert_equal("\u2500x", getline(1))
1111
bwipe!
1212
endfunc
13+
14+
func Test_put_char_block()
15+
new
16+
call setline(1, ['Line 1', 'Line 2'])
17+
f Xfile_put
18+
" visually select both lines and put the cursor at the top of the visual
19+
" selection and then put the buffer name over it
20+
exe "norm! G0\<c-v>ke\"%p"
21+
call assert_equal(['Xfile_put 1', 'Xfile_put 2'], getline(1,2))
22+
bw!
23+
endfunc

src/version.c

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

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
228,
784+
/**/
785+
227,
786+
/**/
787+
226,
788+
/**/
789+
225,
790+
/**/
791+
224,
792+
/**/
793+
223,
782794
/**/
783795
222,
784796
/**/

0 commit comments

Comments
 (0)