mirror of
https://github.com/neovim/neovim.git
synced 2024-12-21 03:35:02 -07:00
Merge #8753 from janlazo/vim-8.0.0724
This commit is contained in:
commit
48c0e916a1
@ -2509,19 +2509,27 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
||||
}
|
||||
// Some versions of Vi use ">=" here, some don't...
|
||||
if (yanklines > (size_t)p_report) {
|
||||
char namebuf[100];
|
||||
|
||||
if (oap->regname == NUL) {
|
||||
*namebuf = NUL;
|
||||
} else {
|
||||
vim_snprintf(namebuf, sizeof(namebuf), _(" into \"%c"), oap->regname);
|
||||
}
|
||||
|
||||
// redisplay now, so message is not deleted
|
||||
update_topline_redraw();
|
||||
if (yanklines == 1) {
|
||||
if (yank_type == kMTBlockWise) {
|
||||
MSG(_("block of 1 line yanked"));
|
||||
smsg(_("block of 1 line yanked%s"), namebuf);
|
||||
} else {
|
||||
MSG(_("1 line yanked"));
|
||||
smsg(_("1 line yanked%s"), namebuf);
|
||||
}
|
||||
} else if (yank_type == kMTBlockWise) {
|
||||
smsg(_("block of %" PRId64 " lines yanked"),
|
||||
(int64_t)yanklines);
|
||||
smsg(_("block of %" PRId64 " lines yanked%s"),
|
||||
(int64_t)yanklines, namebuf);
|
||||
} else {
|
||||
smsg(_("%" PRId64 " lines yanked"), (int64_t)yanklines);
|
||||
smsg(_("%" PRId64 " lines yanked%s"), (int64_t)yanklines, namebuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ NEW_TESTS ?= \
|
||||
test_quickfix.res \
|
||||
test_quotestar.res \
|
||||
test_recover.res \
|
||||
test_registers.res \
|
||||
test_retab.res \
|
||||
test_scrollbind.res \
|
||||
test_search.res \
|
||||
|
65
src/nvim/testdir/test_registers.vim
Normal file
65
src/nvim/testdir/test_registers.vim
Normal file
@ -0,0 +1,65 @@
|
||||
|
||||
func Test_yank_shows_register()
|
||||
enew
|
||||
set report=0
|
||||
call setline(1, ['foo', 'bar'])
|
||||
" Line-wise
|
||||
exe 'norm! yy'
|
||||
call assert_equal('1 line yanked', v:statusmsg)
|
||||
exe 'norm! "zyy'
|
||||
call assert_equal('1 line yanked into "z', v:statusmsg)
|
||||
exe 'norm! yj'
|
||||
call assert_equal('2 lines yanked', v:statusmsg)
|
||||
exe 'norm! "zyj'
|
||||
call assert_equal('2 lines yanked into "z', v:statusmsg)
|
||||
|
||||
" Block-wise
|
||||
exe "norm! \<C-V>y"
|
||||
call assert_equal('block of 1 line yanked', v:statusmsg)
|
||||
exe "norm! \<C-V>\"zy"
|
||||
call assert_equal('block of 1 line yanked into "z', v:statusmsg)
|
||||
exe "norm! \<C-V>jy"
|
||||
call assert_equal('block of 2 lines yanked', v:statusmsg)
|
||||
exe "norm! \<C-V>j\"zy"
|
||||
call assert_equal('block of 2 lines yanked into "z', v:statusmsg)
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_display_registers()
|
||||
e file1
|
||||
e file2
|
||||
call setline(1, ['foo', 'bar'])
|
||||
/bar
|
||||
exe 'norm! y2l"axx'
|
||||
call feedkeys("i\<C-R>=2*4\n\<esc>")
|
||||
call feedkeys(":ls\n", 'xt')
|
||||
|
||||
let a = execute('display')
|
||||
let b = execute('registers')
|
||||
|
||||
call assert_equal(a, b)
|
||||
call assert_match('^\n--- Registers ---\n'
|
||||
\ . '"" a\n'
|
||||
\ . '"0 ba\n'
|
||||
\ . '"1 b\n'
|
||||
\ . '"a b\n'
|
||||
\ . '.*'
|
||||
\ . '"- a\n'
|
||||
\ . '.*'
|
||||
\ . '": ls\n'
|
||||
\ . '"% file2\n'
|
||||
\ . '"# file1\n'
|
||||
\ . '"/ bar\n'
|
||||
\ . '"= 2\*4', a)
|
||||
|
||||
let a = execute('registers a')
|
||||
call assert_match('^\n--- Registers ---\n'
|
||||
\ . '"a b', a)
|
||||
|
||||
let a = execute('registers :')
|
||||
call assert_match('^\n--- Registers ---\n'
|
||||
\ . '": ls', a)
|
||||
|
||||
bwipe!
|
||||
endfunc
|
Loading…
Reference in New Issue
Block a user