vim-patch:9.1.0132: "C" doesn't include composing chars with 'virtualedit' (#27605)

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: vim/vim#14083

048761bcd4
This commit is contained in:
zeertzjq
2024-02-24 22:04:52 +08:00
committed by GitHub
parent 63c9e0c4ae
commit febf481002
2 changed files with 24 additions and 2 deletions

View File

@@ -77,13 +77,30 @@ endfunc
func Test_edit_change()
new
set virtualedit=all
call setline(1, "\t⒌")
normal Cx
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
call setline(1, ['a', 'b', 'c'])
exe "normal gg3l\<C-V>2jcx"
call assert_equal(['a x', 'b x', 'c x'], getline(1, '$'))
bwipe!
set virtualedit=
endfunc