Mercurial > vim
comparison src/testdir/test_scroll_opt.vim @ 32541:75e56c94316d v9.0.1602
patch 9.0.1602: stray character visible if marker on top of double-wide char
Commit: https://github.com/vim/vim/commit/ecb87dd7d3f7b9291092a7dd8fae1e59b9903252
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Jun 3 19:45:06 2023 +0100
patch 9.0.1602: stray character visible if marker on top of double-wide char
Problem: Stray character is visible if 'smoothscroll' marker is displayed
on top of a double-wide character.
Solution: When overwriting a double-width character with the 'smoothscroll'
marker clear the second half. (closes #12469)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Jun 2023 21:00:04 +0200 |
parents | c89816c3e2d7 |
children | ca42967a3253 |
comparison
equal
deleted
inserted
replaced
32540:c8697d448f8c | 32541:75e56c94316d |
---|---|
397 call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {}) | 397 call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {}) |
398 | 398 |
399 call StopVimInTerminal(buf) | 399 call StopVimInTerminal(buf) |
400 endfunc | 400 endfunc |
401 | 401 |
402 " Check that 'smoothscroll' marker is drawn over double-width char correctly. | |
403 " Run with multiple encodings. | |
404 func Test_smoothscroll_marker_over_double_width() | |
405 " Run this in a separate Vim instance to avoid messing up. | |
406 let after =<< trim [CODE] | |
407 scriptencoding utf-8 | |
408 call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10)) | |
409 setlocal smoothscroll | |
410 redraw | |
411 exe "norm \<C-E>" | |
412 redraw | |
413 " Check the chars one by one. Don't check the whole line concatenated. | |
414 call assert_equal('<', screenstring(1, 1)) | |
415 call assert_equal('<', screenstring(1, 2)) | |
416 call assert_equal('<', screenstring(1, 3)) | |
417 call assert_equal(' ', screenstring(1, 4)) | |
418 call assert_equal('口', screenstring(1, 5)) | |
419 call assert_equal('口', screenstring(1, 7)) | |
420 call assert_equal('口', screenstring(1, 9)) | |
421 call assert_equal('口', screenstring(1, 11)) | |
422 call assert_equal('口', screenstring(1, 13)) | |
423 call assert_equal('口', screenstring(1, 15)) | |
424 call writefile(v:errors, 'Xresult') | |
425 qall! | |
426 [CODE] | |
427 | |
428 let encodings = ['utf-8', 'cp932', 'cp936', 'cp949', 'cp950'] | |
429 if !has('win32') | |
430 let encodings += ['euc-jp'] | |
431 endif | |
432 for enc in encodings | |
433 let msg = 'enc=' .. enc | |
434 if RunVim([], after, $'--clean --cmd "set encoding={enc}"') | |
435 call assert_equal([], readfile('Xresult'), msg) | |
436 endif | |
437 call delete('Xresult') | |
438 endfor | |
439 endfunc | |
440 | |
441 " Same as the test above, but check the text actually shown on screen. | |
442 " Only run with UTF-8 encoding. | |
443 func Test_smoothscroll_marker_over_double_width_dump() | |
444 CheckScreendump | |
445 | |
446 let lines =<< trim END | |
447 call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10)) | |
448 setlocal smoothscroll | |
449 END | |
450 call writefile(lines, 'XSmoothMarkerOverDoubleWidth', 'D') | |
451 let buf = RunVimInTerminal('-S XSmoothMarkerOverDoubleWidth', #{rows: 6, cols: 40}) | |
452 call VerifyScreenDump(buf, 'Test_smooth_marker_over_double_width_1', {}) | |
453 | |
454 call term_sendkeys(buf, "\<C-E>") | |
455 call VerifyScreenDump(buf, 'Test_smooth_marker_over_double_width_2', {}) | |
456 | |
457 call StopVimInTerminal(buf) | |
458 endfunc | |
459 | |
402 func s:check_col_calc(win_col, win_line, buf_col) | 460 func s:check_col_calc(win_col, win_line, buf_col) |
403 call assert_equal(a:win_col, wincol()) | 461 call assert_equal(a:win_col, wincol()) |
404 call assert_equal(a:win_line, winline()) | 462 call assert_equal(a:win_line, winline()) |
405 call assert_equal(a:buf_col, col('.')) | 463 call assert_equal(a:buf_col, col('.')) |
406 endfunc | 464 endfunc |