/* 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);
}
}
--- /dev/null
+
+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