mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
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 .".
This commit is contained in:
@@ -2147,6 +2147,7 @@ test_arglist \
|
|||||||
test_options \
|
test_options \
|
||||||
test_packadd \
|
test_packadd \
|
||||||
test_partial \
|
test_partial \
|
||||||
|
test_paste \
|
||||||
test_perl \
|
test_perl \
|
||||||
test_popup \
|
test_popup \
|
||||||
test_profile \
|
test_profile \
|
||||||
@@ -2161,9 +2162,9 @@ test_arglist \
|
|||||||
test_searchpos \
|
test_searchpos \
|
||||||
test_set \
|
test_set \
|
||||||
test_signs \
|
test_signs \
|
||||||
|
test_smartindent \
|
||||||
test_sort \
|
test_sort \
|
||||||
test_source_utf8 \
|
test_source_utf8 \
|
||||||
test_smartindent \
|
|
||||||
test_startup \
|
test_startup \
|
||||||
test_startup_utf8 \
|
test_startup_utf8 \
|
||||||
test_stat \
|
test_stat \
|
||||||
|
@@ -463,7 +463,10 @@ edit(
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
AppendCharToRedobuff(cmdchar);
|
if (cmdchar == K_PS)
|
||||||
|
AppendCharToRedobuff('a');
|
||||||
|
else
|
||||||
|
AppendCharToRedobuff(cmdchar);
|
||||||
if (cmdchar == 'g') /* "gI" command */
|
if (cmdchar == 'g') /* "gI" command */
|
||||||
AppendCharToRedobuff('I');
|
AppendCharToRedobuff('I');
|
||||||
else if (cmdchar == 'r') /* "r<CR>" command */
|
else if (cmdchar == 'r') /* "r<CR>" command */
|
||||||
@@ -9502,8 +9505,10 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
|
|||||||
if (idx == 1 && (c == CAR || c == K_KENTER || c == NL))
|
if (idx == 1 && (c == CAR || c == K_KENTER || c == NL))
|
||||||
ins_eol(c);
|
ins_eol(c);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ins_char_bytes(buf, idx);
|
ins_char_bytes(buf, idx);
|
||||||
AppendToRedobuffLit(buf, idx);
|
AppendToRedobuffLit(buf, idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -173,6 +173,7 @@ NEW_TESTS = test_arglist.res \
|
|||||||
test_nested_function.res \
|
test_nested_function.res \
|
||||||
test_netbeans.res \
|
test_netbeans.res \
|
||||||
test_normal.res \
|
test_normal.res \
|
||||||
|
test_paste.res \
|
||||||
test_packadd.res \
|
test_packadd.res \
|
||||||
test_perl.res \
|
test_perl.res \
|
||||||
test_profile.res \
|
test_profile.res \
|
||||||
|
41
src/testdir/test_paste.vim
Normal file
41
src/testdir/test_paste.vim
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
" Tests for bracketed paste.
|
||||||
|
|
||||||
|
" Bracketed paste only works with "xterm".
|
||||||
|
set term=xterm
|
||||||
|
|
||||||
|
func Test_paste_normal_mode()
|
||||||
|
new
|
||||||
|
call setline(1, ['a', 'b', 'c'])
|
||||||
|
2
|
||||||
|
call feedkeys("\<Esc>[200~foo\<CR>bar\<Esc>[201~", 'xt')
|
||||||
|
call assert_equal('bfoo', getline(2))
|
||||||
|
call assert_equal('bar', getline(3))
|
||||||
|
call assert_equal('c', getline(4))
|
||||||
|
|
||||||
|
normal .
|
||||||
|
call assert_equal('barfoo', getline(3))
|
||||||
|
call assert_equal('bar', getline(4))
|
||||||
|
call assert_equal('c', getline(5))
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_paste_insert_mode()
|
||||||
|
new
|
||||||
|
call setline(1, ['a', 'b', 'c'])
|
||||||
|
2
|
||||||
|
call feedkeys("i\<Esc>[200~foo\<CR>bar\<Esc>[201~ done\<Esc>", 'xt')
|
||||||
|
call assert_equal('foo', getline(2))
|
||||||
|
call assert_equal('bar doneb', getline(3))
|
||||||
|
call assert_equal('c', getline(4))
|
||||||
|
|
||||||
|
normal .
|
||||||
|
call assert_equal('bar donfoo', getline(3))
|
||||||
|
call assert_equal('bar doneeb', getline(4))
|
||||||
|
call assert_equal('c', getline(5))
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_paste_cmdline()
|
||||||
|
call feedkeys(":a\<Esc>[200~foo\<CR>bar\<Esc>[201~b\<Home>\"\<CR>", 'xt')
|
||||||
|
call assert_equal("\"afoo\<CR>barb", getreg(':'))
|
||||||
|
endfunc
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
231,
|
||||||
/**/
|
/**/
|
||||||
230,
|
230,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user