mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit'
Problem: using "C" and 've=all' set, doesn't include composing chars when changing a line, keeps the composing chars for whatever is typed afterwards. Solution: Use mb_head_off() and mb_ptr2len() instead of mb_tail_off(). (zeertzjq) closes: #14083 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
0dc0bff000
commit
048761bcd4
13
src/ops.c
13
src/ops.c
@ -990,13 +990,20 @@ setmarks:
|
|||||||
static void
|
static void
|
||||||
mb_adjust_opend(oparg_T *oap)
|
mb_adjust_opend(oparg_T *oap)
|
||||||
{
|
{
|
||||||
char_u *p;
|
char_u *line;
|
||||||
|
char_u *ptr;
|
||||||
|
|
||||||
if (!oap->inclusive)
|
if (!oap->inclusive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p = ml_get(oap->end.lnum);
|
line = ml_get(oap->end.lnum);
|
||||||
oap->end.col += mb_tail_off(p, p + oap->end.col);
|
ptr = line + oap->end.col;
|
||||||
|
if (*ptr != NUL)
|
||||||
|
{
|
||||||
|
ptr -= (*mb_head_off)(line, ptr);
|
||||||
|
ptr += (*mb_ptr2len)(ptr) - 1;
|
||||||
|
oap->end.col = ptr - line;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -77,13 +77,30 @@ endfunc
|
|||||||
func Test_edit_change()
|
func Test_edit_change()
|
||||||
new
|
new
|
||||||
set virtualedit=all
|
set virtualedit=all
|
||||||
|
|
||||||
call setline(1, "\t⒌")
|
call setline(1, "\t⒌")
|
||||||
normal Cx
|
normal Cx
|
||||||
call assert_equal('x', getline(1))
|
call assert_equal('x', getline(1))
|
||||||
|
|
||||||
|
call setline(1, "\ta̳")
|
||||||
|
normal Cx
|
||||||
|
call assert_equal('x', getline(1))
|
||||||
|
|
||||||
|
call setline(1, "\tβ̳")
|
||||||
|
normal Cx
|
||||||
|
call assert_equal('x', getline(1))
|
||||||
|
|
||||||
|
if has('arabic')
|
||||||
|
call setline(1, "\tلا")
|
||||||
|
normal Cx
|
||||||
|
call assert_equal('x', getline(1))
|
||||||
|
endif
|
||||||
|
|
||||||
" Do a visual block change
|
" Do a visual block change
|
||||||
call setline(1, ['a', 'b', 'c'])
|
call setline(1, ['a', 'b', 'c'])
|
||||||
exe "normal gg3l\<C-V>2jcx"
|
exe "normal gg3l\<C-V>2jcx"
|
||||||
call assert_equal(['a x', 'b x', 'c x'], getline(1, '$'))
|
call assert_equal(['a x', 'b x', 'c x'], getline(1, '$'))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
set virtualedit=
|
set virtualedit=
|
||||||
endfunc
|
endfunc
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
132,
|
||||||
/**/
|
/**/
|
||||||
131,
|
131,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user