Mercurial > vim
changeset 22818:b27601c0d289 v8.2.1957
patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Commit: https://github.com/vim/vim/commit/fabc3ca896751277f18a3a68e5661179728db3ad
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 5 19:07:21 2020 +0100
patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Problem: Diff and cursorcolumn highlighting don't mix.
Solution: Fix condition for what attribute to use. (Christian Brabandt,
closes #7258, closes #7260)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 05 Nov 2020 19:15:03 +0100 |
parents | a5f9d3b1b09b |
children | b6df7d42c633 |
files | src/drawline.c src/testdir/dumps/Test_diff_cuc_01.dump src/testdir/dumps/Test_diff_cuc_02.dump src/testdir/dumps/Test_diff_cuc_03.dump src/testdir/dumps/Test_diff_cuc_04.dump src/testdir/test_diffmode.vim src/version.c |
diffstat | 7 files changed, 121 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/drawline.c +++ b/src/drawline.c @@ -1873,6 +1873,7 @@ win_line( char_u *prev_ptr, *p; int len; hlf_T spell_hlf = HLF_COUNT; + if (has_mbyte) { prev_ptr = ptr - mb_l; @@ -2778,10 +2779,14 @@ win_line( // Also highlight the 'colorcolumn' if 'breakindent' and/or 'showbreak' // options are set vcol_save_attr = -1; - if ((draw_state == WL_LINE || + if (((draw_state == WL_LINE || draw_state == WL_BRI || draw_state == WL_SBR) && !lnum_in_visual_area && search_attr == 0 && area_attr == 0) +# ifdef FEAT_DIFF + && filler_todo <= 0 +# endif + ) { if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol && lnum != wp->w_cursor.lnum)
new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_diff_cuc_01.dump @@ -0,0 +1,20 @@ +>a+0&#ffffff0@1| @34||+1&&| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0@1| @32 +|-+0#4040ff13#afffff255@36||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255@1| @32 +|c+0&#e0e0e08|c+0&#ffffff0| @34||+1&&| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0@1| @32 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1 +| +0&&@74
new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_diff_cuc_02.dump @@ -0,0 +1,20 @@ +|a+0&#ffffff0>a| @34||+1&&| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0@1| @32 +|-+0#4040ff13#afffff255@36||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255@1| @32 +|c+0&#ffffff0|c+0&#e0e0e08| +0&#ffffff0@34||+1&&| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0@1| @32 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|2| @11|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|2| @11|A|l@1 +| +0&&@74
new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_diff_cuc_03.dump @@ -0,0 +1,20 @@ +|a+0&#e0e0e08|a+0&#ffffff0| @34||+1&&| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0@1| @32 +|-+0#4040ff13#afffff255@36||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255@1| @32 +>c+0&#ffffff0@1| @34||+1&&| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0@1| @32 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|1| @11|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|3|,|1| @11|A|l@1 +| +0&&@74
new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_diff_cuc_04.dump @@ -0,0 +1,20 @@ +|a+0&#ffffff0|a+0&#e0e0e08| +0&#ffffff0@34||+1&&| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0@1| @32 +|-+0#4040ff13#afffff255@36||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255@1| @32 +|c+0&#ffffff0>c| @34||+1&&| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0@1| @32 +|~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|2| @11|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|3|,|2| @11|A|l@1 +| +0&&@74
--- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -1150,4 +1150,37 @@ func Test_diff_and_scroll() set ls& endfunc +func Test_diff_filler_cursorcolumn() + CheckScreendump + + let content =<< trim END + call setline(1, ['aa', 'bb', 'cc']) + vnew + call setline(1, ['aa', 'cc']) + windo diffthis + wincmd p + setlocal cursorcolumn foldcolumn=0 + norm! gg0 + redraw! + END + call writefile(content, 'Xtest_diff_cuc') + let buf = RunVimInTerminal('-S Xtest_diff_cuc', {}) + + call VerifyScreenDump(buf, 'Test_diff_cuc_01', {}) + + call term_sendkeys(buf, "l") + call term_sendkeys(buf, "\<C-l>") + call VerifyScreenDump(buf, 'Test_diff_cuc_02', {}) + call term_sendkeys(buf, "0j") + call term_sendkeys(buf, "\<C-l>") + call VerifyScreenDump(buf, 'Test_diff_cuc_03', {}) + call term_sendkeys(buf, "l") + call term_sendkeys(buf, "\<C-l>") + call VerifyScreenDump(buf, 'Test_diff_cuc_04', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtest_diff_cuc') +endfunc + " vim: shiftwidth=2 sts=2 expandtab