Mercurial > vim
comparison src/testdir/test_textprop.vim @ 32981:2415680a2554 v9.0.1783
commit b557f4898208105b674df605403cac1b1292707b
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Aug 22 22:07:34 2023 +0200
patch 9.0.1783: Display issues with virt text smoothscroll and showbreak
Problem: Wrong display with wrapping virtual text or unprintable chars,
'showbreak' and 'smoothscroll'.
Solution: Don't skip cells taken by 'showbreak' in screen lines before
"w_skipcol". Combined "n_skip" and "skip_cells".
closes: #12597
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 24 Aug 2023 07:47:10 +0200 |
parents | c7a332a34fe7 |
children | 68a12270d21b ebb36e3d5299 |
comparison
equal
deleted
inserted
replaced
32964:c7a332a34fe7 | 32981:2415680a2554 |
---|---|
2628 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_7', {}) | 2628 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_7', {}) |
2629 | 2629 |
2630 call StopVimInTerminal(buf) | 2630 call StopVimInTerminal(buf) |
2631 endfunc | 2631 endfunc |
2632 | 2632 |
2633 func Run_test_prop_inserts_text_showbreak(cmd) | |
2634 CheckRunVimInTerminal | |
2635 | |
2636 let lines =<< trim END | |
2637 highlight! link LineNr Normal | |
2638 call setline(1, repeat('a', 28)) | |
2639 call prop_type_add('theprop', #{highlight: 'Special'}) | |
2640 call prop_add(1, 28, #{type: 'theprop', text: repeat('123', 23), text_wrap: 'wrap'}) | |
2641 setlocal number showbreak=+ breakindent breakindentopt=shift:2 | |
2642 setlocal scrolloff=0 smoothscroll | |
2643 normal! $ | |
2644 END | |
2645 let lines = insert(lines, a:cmd) | |
2646 call writefile(lines, 'XscriptPropsShowbreak', 'D') | |
2647 let buf = RunVimInTerminal('-S XscriptPropsShowbreak', #{rows: 6, cols: 30}) | |
2648 call term_sendkeys(buf, ":set noruler\<CR>") | |
2649 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_1', {}) | |
2650 call term_sendkeys(buf, "\<C-E>") | |
2651 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_2', {}) | |
2652 call term_sendkeys(buf, "\<C-E>") | |
2653 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_3', {}) | |
2654 call term_sendkeys(buf, "\<C-E>") | |
2655 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_4', {}) | |
2656 call term_sendkeys(buf, "\<C-E>") | |
2657 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_5', {}) | |
2658 call term_sendkeys(buf, "zbi") | |
2659 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_6', {}) | |
2660 call term_sendkeys(buf, "\<BS>") | |
2661 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_7', {}) | |
2662 call term_sendkeys(buf, "\<Esc>l") | |
2663 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_8', {}) | |
2664 call term_sendkeys(buf, "\<C-E>") | |
2665 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_9', {}) | |
2666 call term_sendkeys(buf, "\<C-E>") | |
2667 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_10', {}) | |
2668 call term_sendkeys(buf, "\<C-E>") | |
2669 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_11', {}) | |
2670 call term_sendkeys(buf, "\<C-E>") | |
2671 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_12', {}) | |
2672 call term_sendkeys(buf, "023x$") | |
2673 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_13', {}) | |
2674 call term_sendkeys(buf, "\<C-E>") | |
2675 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_14', {}) | |
2676 call term_sendkeys(buf, "\<C-E>") | |
2677 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_15', {}) | |
2678 call term_sendkeys(buf, "\<C-E>") | |
2679 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_16', {}) | |
2680 call term_sendkeys(buf, "zbi") | |
2681 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_17', {}) | |
2682 call term_sendkeys(buf, "\<C-U>") | |
2683 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_18', {}) | |
2684 call term_sendkeys(buf, "\<Esc>") | |
2685 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_19', {}) | |
2686 call term_sendkeys(buf, "\<C-E>") | |
2687 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_20', {}) | |
2688 call term_sendkeys(buf, "\<C-E>") | |
2689 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_21', {}) | |
2690 | |
2691 call StopVimInTerminal(buf) | |
2692 endfunc | |
2693 | |
2694 func Test_prop_inserts_text_showbreak() | |
2695 call Run_test_prop_inserts_text_showbreak('') | |
2696 " because of 'breakindent' the screendumps are the same | |
2697 call Run_test_prop_inserts_text_showbreak('set cpoptions+=n') | |
2698 endfunc | |
2699 | |
2700 func Test_prop_before_tab_skipcol() | |
2701 CheckRunVimInTerminal | |
2702 | |
2703 let lines =<< trim END | |
2704 call setline(1, repeat("\t", 4) .. 'a') | |
2705 call prop_type_add('theprop', #{highlight: 'Special'}) | |
2706 call prop_add(1, 4, #{type: 'theprop', text: repeat('12', 32), text_wrap: 'wrap'}) | |
2707 setlocal list listchars=tab:<-> scrolloff=0 smoothscroll | |
2708 normal! $ | |
2709 END | |
2710 call writefile(lines, 'XscriptPropsBeforeTabSkipcol', 'D') | |
2711 let buf = RunVimInTerminal('-S XscriptPropsBeforeTabSkipcol', #{rows: 6, cols: 30}) | |
2712 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_1', {}) | |
2713 call term_sendkeys(buf, "\<C-E>") | |
2714 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_2', {}) | |
2715 call term_sendkeys(buf, "\<C-E>") | |
2716 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_3', {}) | |
2717 call term_sendkeys(buf, "\<C-E>") | |
2718 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_4', {}) | |
2719 call term_sendkeys(buf, "zbh") | |
2720 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_5', {}) | |
2721 call term_sendkeys(buf, "i") | |
2722 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_6', {}) | |
2723 call term_sendkeys(buf, "\<C-O>:setlocal nolist\<CR>") | |
2724 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_7', {}) | |
2725 call term_sendkeys(buf, "\<Esc>l") | |
2726 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_8', {}) | |
2727 call term_sendkeys(buf, "\<C-E>") | |
2728 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_9', {}) | |
2729 call term_sendkeys(buf, "\<C-E>") | |
2730 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_10', {}) | |
2731 call term_sendkeys(buf, "\<C-E>") | |
2732 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_11', {}) | |
2733 | |
2734 call StopVimInTerminal(buf) | |
2735 endfunc | |
2736 | |
2633 func Test_prop_add_with_text_fails() | 2737 func Test_prop_add_with_text_fails() |
2634 call prop_type_add('failing', #{highlight: 'ErrorMsg'}) | 2738 call prop_type_add('failing', #{highlight: 'ErrorMsg'}) |
2635 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_lnum: 1})", 'E1305:') | 2739 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_lnum: 1})", 'E1305:') |
2636 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_col: 1})", 'E1305:') | 2740 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_col: 1})", 'E1305:') |
2637 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', length: 1})", 'E1305:') | 2741 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', length: 1})", 'E1305:') |