patch 9.1.0320: Wrong cursor position after using setcellwidths()
Problem: Wrong cursor position after using setcellwidths().
Solution: Invalidate cursor position in addition to redrawing.
(zeertzjq)
closes: #14545
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_utf8.vim b/src/testdir/test_utf8.vim
index 112b5a6..deb96ea 100644
--- a/src/testdir/test_utf8.vim
+++ b/src/testdir/test_utf8.vim
@@ -170,6 +170,7 @@
endfunc
func Test_setcellwidths()
+ new
call setcellwidths([
\ [0x1330, 0x1330, 2],
\ [9999, 10000, 1],
@@ -212,6 +213,18 @@
" Ambiguous width chars
call assert_equal(2, strwidth("\u00A1"))
call assert_equal(2, strwidth("\u2010"))
+
+ call setcellwidths([])
+ call setline(1, repeat("\u2103", 10))
+ normal! $
+ redraw
+ call assert_equal((aw == 'single') ? 10 : 19, wincol())
+ call setcellwidths([[0x2103, 0x2103, 1]])
+ redraw
+ call assert_equal(10, wincol())
+ call setcellwidths([[0x2103, 0x2103, 2]])
+ redraw
+ call assert_equal(19, wincol())
endfor
set ambiwidth& isprint&
@@ -245,6 +258,7 @@
set listchars&
set fillchars&
call setcellwidths([])
+ bwipe!
endfunc
func Test_getcellwidths()