Skip to content

Commit 076e502

Browse files
committed
patch 8.0.0231: bracketed paste mode is not tested
Problem: There are no tests for bracketed paste mode. Solution: Add a test. Fix repeating with "normal .".
1 parent 915350e commit 076e502

5 files changed

Lines changed: 53 additions & 3 deletions

File tree

src/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,7 @@ test_arglist \
21472147
test_options \
21482148
test_packadd \
21492149
test_partial \
2150+
test_paste \
21502151
test_perl \
21512152
test_popup \
21522153
test_profile \
@@ -2161,9 +2162,9 @@ test_arglist \
21612162
test_searchpos \
21622163
test_set \
21632164
test_signs \
2165+
test_smartindent \
21642166
test_sort \
21652167
test_source_utf8 \
2166-
test_smartindent \
21672168
test_startup \
21682169
test_startup_utf8 \
21692170
test_stat \

src/edit.c

Lines changed: 7 additions & 2 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 */
@@ -9502,8 +9505,10 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
95029505
if (idx == 1 && (c == CAR || c == K_KENTER || c == NL))
95039506
ins_eol(c);
95049507
else
9508+
{
95059509
ins_char_bytes(buf, idx);
9506-
AppendToRedobuffLit(buf, idx);
9510+
AppendToRedobuffLit(buf, idx);
9511+
}
95079512
}
95089513
break;
95099514

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_paste.vim

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

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
231,
767769
/**/
768770
230,
769771
/**/

0 commit comments

Comments
 (0)