diff options
Diffstat (limited to 'test/old/testdir/test_scroll_opt.vim')
-rw-r--r-- | test/old/testdir/test_scroll_opt.vim | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 5ac80764b5..48b8cb301f 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -399,6 +399,67 @@ func Test_smoothscroll_long_line_showbreak() call StopVimInTerminal(buf) endfunc +" Check that 'smoothscroll' marker is drawn over double-width char correctly. +" Run with multiple encodings. +func Test_smoothscroll_marker_over_double_width() + " Run this in a separate Vim instance to avoid messing up. + let after =<< trim [CODE] + scriptencoding utf-8 + call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10)) + setlocal smoothscroll + redraw + exe "norm \<C-E>" + redraw + " Check the chars one by one. Don't check the whole line concatenated. + call assert_equal('<', screenstring(1, 1)) + call assert_equal('<', screenstring(1, 2)) + call assert_equal('<', screenstring(1, 3)) + call assert_equal(' ', screenstring(1, 4)) + call assert_equal('口', screenstring(1, 5)) + call assert_equal('口', screenstring(1, 7)) + call assert_equal('口', screenstring(1, 9)) + call assert_equal('口', screenstring(1, 11)) + call assert_equal('口', screenstring(1, 13)) + call assert_equal('口', screenstring(1, 15)) + call writefile(v:errors, 'Xresult') + qall! + [CODE] + + let encodings = ['utf-8', 'cp932', 'cp936', 'cp949', 'cp950'] + if !has('win32') + let encodings += ['euc-jp'] + endif + if has('nvim') + let encodings = ['utf-8'] + endif + for enc in encodings + let msg = 'enc=' .. enc + if RunVim([], after, $'--clean --cmd "set encoding={enc}"') + call assert_equal([], readfile('Xresult'), msg) + endif + call delete('Xresult') + endfor +endfunc + +" Same as the test above, but check the text actually shown on screen. +" Only run with UTF-8 encoding. +func Test_smoothscroll_marker_over_double_width_dump() + CheckScreendump + + let lines =<< trim END + call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10)) + setlocal smoothscroll + END + call writefile(lines, 'XSmoothMarkerOverDoubleWidth', 'D') + let buf = RunVimInTerminal('-S XSmoothMarkerOverDoubleWidth', #{rows: 6, cols: 40}) + call VerifyScreenDump(buf, 'Test_smooth_marker_over_double_width_1', {}) + + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_smooth_marker_over_double_width_2', {}) + + call StopVimInTerminal(buf) +endfunc + func s:check_col_calc(win_col, win_line, buf_col) call assert_equal(a:win_col, wincol()) call assert_equal(a:win_line, winline()) |