Permalink
Browse files

patch 8.0.0724: the message for yanking doesn't indicate the register

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)
  • Loading branch information...
brammool committed Jul 16, 2017
1 parent 9b50bba commit e45deb79978677cb41f1477ba4140bccff658fd1
Showing with 45 additions and 4 deletions.
  1. +1 −0 src/Makefile
  2. +14 −4 src/ops.c
  3. +1 −0 src/testdir/Make_all.mak
  4. +27 −0 src/testdir/test_registers.vim
  5. +2 −0 src/version.c
View
@@ -2227,6 +2227,7 @@ test_arglist \
test_regex_char_classes \
test_regexp_latin \
test_regexp_utf8 \
test_registers \
test_reltime \
test_retab \
test_ruby \
View
@@ -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);

This comment has been minimized.

Show comment
Hide comment
@LemonBoy

LemonBoy Jul 16, 2017

I think this string should be translatable

@LemonBoy

LemonBoy Jul 16, 2017

I think this string should be translatable

This comment has been minimized.

Show comment
Hide comment
@k-takata

k-takata Jul 17, 2017

Member

The patch 8.0.0727 just added _() around this string, but it is hard to translate or becomes unnatural when translated, because some languages like Japanese have different word order to English.

I wrote a patch for this:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/da52a55e22d0da7c76b9ca9f2791a463468e9232/fix-8.0.0724-0727-translation.patch?fileviewer=file-view-default

@k-takata

k-takata Jul 17, 2017

Member

The patch 8.0.0727 just added _() around this string, but it is hard to translate or becomes unnatural when translated, because some languages like Japanese have different word order to English.

I wrote a patch for this:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/da52a55e22d0da7c76b9ca9f2791a463468e9232/fix-8.0.0724-0727-translation.patch?fileviewer=file-view-default

This comment has been minimized.

Show comment
Hide comment
@brammool

brammool Jul 17, 2017

Contributor
@brammool

brammool via email Jul 17, 2017

Contributor

This comment has been minimized.

Show comment
Hide comment
@k-takata

k-takata Jul 18, 2017

Member

Ah, you're right!

I was hoping that moving the %s to somewhere in the translation would work.

I overlooked the %s and misunderstood as it was just concatenating.
I withdraw the patch.

@k-takata

k-takata Jul 18, 2017

Member

Ah, you're right!

I was hoping that moving the %s to somewhere in the translation would work.

I overlooked the %s and misunderstood as it was just concatenating.
I withdraw the patch.

/* 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);
}
}
View
@@ -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 \
@@ -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
View
@@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
724,
/**/
723,
/**/

0 comments on commit e45deb7

Please sign in to comment.