Problem: Using "ra" in multiple lines on multi-byte characters leaves a few
characters not replaced.
Solution: Adjust the end column only in the last line. (Yasuhiro Matsumoto)
{
/* This is slow, but it handles replacing a single-byte
* with a multi-byte and the other way around. */
- oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
+ if (curwin->w_cursor.lnum == oap->end.lnum)
+ oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
n = State;
State = REPLACE;
ins_char(c);
Test for multi-byte text formatting.
Also test, that 'mps' with multibyte chars works.
+And test "ra" on multi-byte characters.
STARTTEST
:so mbyte.vim
{
‘ two three ’ four
}
+STARTTEST
+/^ra test
+jVjra
+ENDTEST
+
+ra test
+abba
+aab
+
STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/^Results/,$wq! test.out
{
four
}
+
+ra test
+aaaa
+aaa
+
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 853,
/**/
852,
/**/