Skip to content

Commit 97ed4ba

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents e80371b + ba47b51 commit 97ed4ba

11 files changed

+129
-9
lines changed

src/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2164,6 +2164,7 @@ test_arglist \
21642164
test_options \
21652165
test_packadd \
21662166
test_partial \
2167+
test_paste \
21672168
test_perl \
21682169
test_popup \
21692170
test_profile \
@@ -2178,9 +2179,9 @@ test_arglist \
21782179
test_searchpos \
21792180
test_set \
21802181
test_signs \
2182+
test_smartindent \
21812183
test_sort \
21822184
test_source_utf8 \
2183-
test_smartindent \
21842185
test_startup \
21852186
test_startup_utf8 \
21862187
test_stat \

src/buffer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,6 +2157,7 @@ free_buf_options(
21572157
#if defined(FEAT_CRYPT)
21582158
clear_string_option(&buf->b_p_cm);
21592159
#endif
2160+
clear_string_option(&buf->b_p_fp);
21602161
#if defined(FEAT_EVAL)
21612162
clear_string_option(&buf->b_p_fex);
21622163
#endif

src/edit.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ edit(
463463
else
464464
#endif
465465
{
466-
AppendCharToRedobuff(cmdchar);
466+
if (cmdchar == K_PS)
467+
AppendCharToRedobuff('a');
468+
else
469+
AppendCharToRedobuff(cmdchar);
467470
if (cmdchar == 'g') /* "gI" command */
468471
AppendCharToRedobuff('I');
469472
else if (cmdchar == 'r') /* "r<CR>" command */
@@ -531,6 +534,10 @@ edit(
531534
revins_legal = 0;
532535
revins_scol = -1;
533536
#endif
537+
if (!p_ek)
538+
/* Disable bracketed paste mode, we won't recognize the escape
539+
* sequences. */
540+
out_str(T_BD);
534541

535542
/*
536543
* Handle restarting Insert mode.
@@ -8634,6 +8641,9 @@ ins_esc(
86348641
#ifdef CURSOR_SHAPE
86358642
ui_cursor_shape(); /* may show different cursor shape */
86368643
#endif
8644+
if (!p_ek)
8645+
/* Re-enable bracketed paste mode. */
8646+
out_str(T_BE);
86378647

86388648
/*
86398649
* When recording or for CTRL-O, need to display the new mode.
@@ -9531,8 +9541,14 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
95319541
case PASTE_INSERT:
95329542
if (stop_arrow() == OK)
95339543
{
9534-
ins_char_bytes(buf, idx);
9535-
AppendToRedobuffLit(buf, idx);
9544+
c = buf[0];
9545+
if (idx == 1 && (c == CAR || c == K_KENTER || c == NL))
9546+
ins_eol(c);
9547+
else
9548+
{
9549+
ins_char_bytes(buf, idx);
9550+
AppendToRedobuffLit(buf, idx);
9551+
}
95369552
}
95379553
break;
95389554

src/ex_getln.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4377,7 +4377,9 @@ addstar(
43774377
|| context == EXPAND_OWNSYNTAX
43784378
|| context == EXPAND_FILETYPE
43794379
|| context == EXPAND_PACKADD
4380-
|| (context == EXPAND_TAGS && fname[0] == '/'))
4380+
|| ((context == EXPAND_TAGS_LISTFILES
4381+
|| context == EXPAND_TAGS)
4382+
&& fname[0] == '/'))
43814383
retval = vim_strnsave(fname, len);
43824384
else
43834385
{

src/ops.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3774,16 +3774,25 @@ do_put(
37743774
*/
37753775
if (y_type == MCHAR && y_size == 1)
37763776
{
3777-
linenr_T end = curbuf->b_visual.vi_end.lnum;
3777+
linenr_T end_lnum = 0; /* init for gcc */
37783778

3779-
if (curbuf->b_visual.vi_end.lnum < curbuf->b_visual.vi_start.lnum)
3780-
end = curbuf->b_visual.vi_start.lnum;
3779+
if (VIsual_active)
3780+
{
3781+
end_lnum = curbuf->b_visual.vi_end.lnum;
3782+
if (end_lnum < curbuf->b_visual.vi_start.lnum)
3783+
end_lnum = curbuf->b_visual.vi_start.lnum;
3784+
}
37813785

37823786
do {
37833787
totlen = count * yanklen;
37843788
if (totlen > 0)
37853789
{
37863790
oldp = ml_get(lnum);
3791+
if (VIsual_active && col > (int)STRLEN(oldp))
3792+
{
3793+
lnum++;
3794+
continue;
3795+
}
37873796
newp = alloc_check((unsigned)(STRLEN(oldp) + totlen + 1));
37883797
if (newp == NULL)
37893798
goto end; /* alloc() gave an error message */
@@ -3806,7 +3815,7 @@ do_put(
38063815
}
38073816
if (VIsual_active)
38083817
lnum++;
3809-
} while (VIsual_active && lnum <= end);
3818+
} while (VIsual_active && lnum <= end_lnum);
38103819

38113820
if (VIsual_active) /* reset lnum to the last visual line */
38123821
lnum--;

src/screen.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,6 +3651,7 @@ win_line(
36513651
{
36523652
/* Draw the 'foldcolumn'. Allocate a buffer, "extra" may
36533653
* already be in use. */
3654+
vim_free(p_extra_free);
36543655
p_extra_free = alloc(12 + 1);
36553656

36563657
if (p_extra_free != NULL)
@@ -4695,6 +4696,7 @@ win_line(
46954696
p = alloc((unsigned)(len + 1));
46964697
vim_memset(p, ' ', len);
46974698
p[len] = NUL;
4699+
vim_free(p_extra_free);
46984700
p_extra_free = p;
46994701
for (i = 0; i < tab_len; i++)
47004702
{
@@ -4857,6 +4859,7 @@ win_line(
48574859
vim_memset(p, ' ', n_extra);
48584860
STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1);
48594861
p[n_extra] = NUL;
4862+
vim_free(p_extra_free);
48604863
p_extra_free = p_extra = p;
48614864
}
48624865
else
@@ -5789,6 +5792,7 @@ win_line(
57895792
}
57905793
#endif
57915794

5795+
vim_free(p_extra_free);
57925796
return row;
57935797
}
57945798

src/testdir/Make_all.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ NEW_TESTS = test_arglist.res \
173173
test_nested_function.res \
174174
test_netbeans.res \
175175
test_normal.res \
176+
test_paste.res \
176177
test_packadd.res \
177178
test_perl.res \
178179
test_profile.res \

src/testdir/test_cmdline.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,3 +295,14 @@ func Test_illegal_address()
295295
2;')
296296
quit
297297
endfunc
298+
299+
func Test_cmdline_complete_wildoptions()
300+
help
301+
call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx')
302+
let a = join(sort(split(@:)),' ')
303+
set wildoptions=tagfile
304+
call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx')
305+
let b = join(sort(split(@:)),' ')
306+
call assert_equal(a, b)
307+
bw!
308+
endfunc

src/testdir/test_paste.vim

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
" Tests for bracketed paste.
2+
3+
" Bracketed paste only works with "xterm". Not in GUI.
4+
if has('gui_running')
5+
finish
6+
endif
7+
set term=xterm
8+
9+
func Test_paste_normal_mode()
10+
new
11+
call setline(1, ['a', 'b', 'c'])
12+
2
13+
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
14+
call assert_equal('bfoo', getline(2))
15+
call assert_equal('bar', getline(3))
16+
call assert_equal('c', getline(4))
17+
18+
normal .
19+
call assert_equal('barfoo', getline(3))
20+
call assert_equal('bar', getline(4))
21+
call assert_equal('c', getline(5))
22+
bwipe!
23+
endfunc
24+
25+
func Test_paste_insert_mode()
26+
new
27+
call setline(1, ['a', 'b', 'c'])
28+
2
29+
call feedkeys("i\<Esc>[200~foo\<CR>bar\<Esc>[201~ done\<Esc>", 'xt')
30+
call assert_equal('foo', getline(2))
31+
call assert_equal('bar doneb', getline(3))
32+
call assert_equal('c', getline(4))
33+
34+
normal .
35+
call assert_equal('bar donfoo', getline(3))
36+
call assert_equal('bar doneeb', getline(4))
37+
call assert_equal('c', getline(5))
38+
bwipe!
39+
endfunc
40+
41+
func Test_paste_cmdline()
42+
call feedkeys(":a\<Esc>[200~foo\<CR>bar\<Esc>[201~b\<Home>\"\<CR>", 'xt')
43+
call assert_equal("\"afoo\<CR>barb", getreg(':'))
44+
endfunc

src/testdir/test_put.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,16 @@ func Test_put_char_block()
2121
call assert_equal(['Xfile_put 1', 'Xfile_put 2'], getline(1,2))
2222
bw!
2323
endfunc
24+
25+
func Test_put_char_block2()
26+
new
27+
let a = [ getreg('a'), getregtype('a') ]
28+
call setreg('a', ' one ', 'v')
29+
call setline(1, ['Line 1', '', 'Line 3', ''])
30+
" visually select the first 3 lines and put register a over it
31+
exe "norm! ggl\<c-v>2j2l\"ap"
32+
call assert_equal(['L one 1', '', 'L one 3', ''], getline(1,4))
33+
" clean up
34+
bw!
35+
call setreg('a', a[0], a[1])
36+
endfunc

src/version.c

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

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
237,
784+
/**/
785+
236,
786+
/**/
787+
235,
788+
/**/
789+
234,
790+
/**/
791+
233,
792+
/**/
793+
232,
794+
/**/
795+
231,
796+
/**/
797+
230,
798+
/**/
799+
229,
782800
/**/
783801
228,
784802
/**/

0 commit comments

Comments
 (0)