Skip to content

Commit c812996

Browse files
committed
patch 8.0.0222: blockwise put on multi-byte character misplaced
Problem: When a multi-byte character ends in a zero byte, putting blockwise text puts it before the character instead of after it. Solution: Use int instead of char for the character under the cursor. (Luchr, closes #1403) Add a test.
1 parent 6a8ede9 commit c812996

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,6 +2150,7 @@ test_arglist \
21502150
test_perl \
21512151
test_popup \
21522152
test_profile \
2153+
test_put \
21532154
test_quickfix \
21542155
test_regexp_latin \
21552156
test_regexp_utf8 \

src/ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3550,7 +3550,7 @@ do_put(
35503550
*/
35513551
if (y_type == MBLOCK)
35523552
{
3553-
char c = gchar_cursor();
3553+
int c = gchar_cursor();
35543554
colnr_T endcol2 = 0;
35553555

35563556
if (dir == FORWARD && c != NUL)

src/testdir/test_alot.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ source test_mapping.vim
3131
source test_messages.vim
3232
source test_partial.vim
3333
source test_popup.vim
34+
source test_put.vim
3435
source test_reltime.vim
3536
source test_searchpos.vim
3637
source test_set.vim

src/testdir/test_put.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
func Test_put_block()
3+
if !has('multi_byte')
4+
return
5+
endif
6+
new
7+
call feedkeys("i\<C-V>u2500\<CR>x\<ESC>", 'x')
8+
call feedkeys("\<C-V>y", 'x')
9+
call feedkeys("gg0p", 'x')
10+
call assert_equal("\u2500x", getline(1))
11+
bwipe!
12+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
222,
767769
/**/
768770
221,
769771
/**/

0 commit comments

Comments
 (0)