diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-07-16 17:56:16 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-07-16 17:56:16 +0200 |
commit | e45deb79978677cb41f1477ba4140bccff658fd1 (patch) | |
tree | 61497b56b7a9fe1525645a3f1c1979753825a603 | |
parent | 9b50bba643f8d1fcac91e11780da7d03d8995260 (diff) | |
download | vim-git-e45deb79978677cb41f1477ba4140bccff658fd1.tar.gz |
patch 8.0.0724: the message for yanking doesn't indicate the registerv8.0.0724
Problem: The message for yanking doesn't indicate the register.
Solution: Show the register name in the "N lines yanked" message. (Lemonboy,
closes #1803, closes #1809)
-rw-r--r-- | src/Makefile | 1 | ||||
-rw-r--r-- | src/ops.c | 18 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 1 | ||||
-rw-r--r-- | src/testdir/test_registers.vim | 27 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 45 insertions, 4 deletions
diff --git a/src/Makefile b/src/Makefile index 6c236ca71..80265fd5b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2227,6 +2227,7 @@ test_arglist \ test_regex_char_classes \ test_regexp_latin \ test_regexp_utf8 \ + test_registers \ test_reltime \ test_retab \ test_ruby \ @@ -3167,19 +3167,29 @@ op_yank(oparg_T *oap, int deleting, int mess) /* Some versions of Vi use ">=" here, some don't... */ if (yanklines > 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 (oap->block_mode) - MSG(_("block of 1 line yanked")); + smsg((char_u *)_("block of 1 line yanked%s"), namebuf); else - MSG(_("1 line yanked")); + smsg((char_u *)_("1 line yanked%s"), namebuf); } else if (oap->block_mode) - smsg((char_u *)_("block of %ld lines yanked"), yanklines); + smsg((char_u *)_("block of %ld lines yanked%s"), + yanklines, namebuf); else - smsg((char_u *)_("%ld lines yanked"), yanklines); + smsg((char_u *)_("%ld lines yanked%s"), yanklines, + namebuf); } } diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 217a29547..16068816e 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -184,6 +184,7 @@ NEW_TESTS = test_arabic.res \ test_quickfix.res \ test_quotestar.res \ test_retab.res \ + test_registers.res \ test_ruby.res \ test_search.res \ test_signs.res \ diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim new file mode 100644 index 000000000..912a5c7e3 --- /dev/null +++ b/src/testdir/test_registers.vim @@ -0,0 +1,27 @@ + +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 diff --git a/src/version.c b/src/version.c index 1b2cc8a95..e8e2e059e 100644 --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 724, +/**/ 723, /**/ 722, |