diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-10-02 18:26:10 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-10-02 18:26:10 +0200 |
commit | 4a5abbd6138240d109278fe1f0b45489d22f712d (patch) | |
tree | b564a80ec261f5233d5a14446a69425e9d7391c0 /src | |
parent | 586c70cdfede55a166e3564f1cb68a299d81987d (diff) | |
download | vim-git-8.1.0448.tar.gz |
patch 8.1.0448: cursorline not removed when using 'cursorbind'v8.1.0448
Problem: Cursorline not removed when using 'cursorbind'. (Justin Keyes)
Solution: Store the last cursor line per window. (closes #3488)
Diffstat (limited to 'src')
-rw-r--r-- | src/move.c | 16 | ||||
-rw-r--r-- | src/structs.h | 4 | ||||
-rw-r--r-- | src/testdir/dumps/Test_diff_with_cursorline_01.dump | 20 | ||||
-rw-r--r-- | src/testdir/dumps/Test_diff_with_cursorline_02.dump | 20 | ||||
-rw-r--r-- | src/testdir/dumps/Test_diff_with_cursorline_03.dump | 20 | ||||
-rw-r--r-- | src/testdir/test_diffmode.vim | 26 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 99 insertions, 9 deletions
diff --git a/src/move.c b/src/move.c index cc399ec9e..214c362f4 100644 --- a/src/move.c +++ b/src/move.c @@ -117,12 +117,10 @@ comp_botline(win_T *wp) } #ifdef FEAT_SYN_HL -static linenr_T last_cursorline = 0; - void reset_cursorline(void) { - last_cursorline = 0; + curwin->w_last_cursorline = 0; } #endif @@ -150,18 +148,18 @@ redraw_for_cursorline(win_T *wp) #ifdef FEAT_SYN_HL if (wp->w_p_cul) { - if (wp->w_redr_type <= VALID && last_cursorline != 0) + if (wp->w_redr_type <= VALID && wp->w_last_cursorline != 0) { - // "last_cursorline" may be set for another window, worst case - // we redraw too much. This is optimized for moving the cursor - // around in the same window. - redrawWinline(wp, last_cursorline, FALSE); + // "w_last_cursorline" may be outdated, worst case we redraw + // too much. This is optimized for moving the cursor around in + // the current window. + redrawWinline(wp, wp->w_last_cursorline, FALSE); redrawWinline(wp, wp->w_cursor.lnum, FALSE); redraw_win_later(wp, VALID); } else redraw_win_later(wp, SOME_VALID); - last_cursorline = wp->w_cursor.lnum; + wp->w_last_cursorline = wp->w_cursor.lnum; } #endif } diff --git a/src/structs.h b/src/structs.h index 7a74e8f68..da4ffb856 100644 --- a/src/structs.h +++ b/src/structs.h @@ -2686,6 +2686,10 @@ struct window_S time through cursupdate() to the current virtual column */ +#ifdef FEAT_SYN_HL + linenr_T w_last_cursorline; // where last time 'cursorline' was drawn +#endif + /* * the next seven are used to update the visual part */ diff --git a/src/testdir/dumps/Test_diff_with_cursorline_01.dump b/src/testdir/dumps/Test_diff_with_cursorline_01.dump new file mode 100644 index 000000000..96fa3572f --- /dev/null +++ b/src/testdir/dumps/Test_diff_with_cursorline_01.dump @@ -0,0 +1,20 @@ +| +0#0000e05#a8a8a8255@1|b+8#ffffff16#ff404010|e@1| @31||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34 +| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1>f+8#ffffff16#ff404010|o@1| @31 +| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31 +| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010|a|z| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|f+2#0000000#ff404010|o@1| +0&#ffd7ff255@31 +| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|a|r| @31 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1| |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1 +| +0&&@74 diff --git a/src/testdir/dumps/Test_diff_with_cursorline_02.dump b/src/testdir/dumps/Test_diff_with_cursorline_02.dump new file mode 100644 index 000000000..1ba44e6e3 --- /dev/null +++ b/src/testdir/dumps/Test_diff_with_cursorline_02.dump @@ -0,0 +1,20 @@ +| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|e@1| @31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34 +| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31 +| +0#0000e05#a8a8a8255@1|f+8#ffffff16#ff404010|o@1| @31||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1>f+8#ffffff16#ff404010|o@1| @31 +| +0#0000e05#a8a8a8255@1|b+2#0000000#ff404010|a|z| +0&#ffd7ff255@31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|f+2#0000000#ff404010|o@1| +0&#ffd7ff255@31 +| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|a|r| @31 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|3|,|1| @11|A|l@1| |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|1| @11|A|l@1 +| +0&&@74 diff --git a/src/testdir/dumps/Test_diff_with_cursorline_03.dump b/src/testdir/dumps/Test_diff_with_cursorline_03.dump new file mode 100644 index 000000000..8dbb41481 --- /dev/null +++ b/src/testdir/dumps/Test_diff_with_cursorline_03.dump @@ -0,0 +1,20 @@ +| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|e@1| @31||+1&#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34 +| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31 +| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31||+1&&| +0#0000e05#a8a8a8255@1|f+0#0000000#ffffff0|o@1| @31 +| +0#0000e05#a8a8a8255@1|b+10#ffffff16#ff404010|a|z| +8&&@31||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1>f+10#ffffff16#ff404010|o@1| +8&&@31 +| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255|a|r| @31 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33 +|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|4|,|1| @11|A|l@1| |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|3|,|1| @11|A|l@1 +| +0&&@74 diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim index 1deb23873..760440a9b 100644 --- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -817,3 +817,29 @@ func Test_diff_screen() call delete('Xfile2') endfunc +func Test_diff_with_cursorline() + if !CanRunVimInTerminal() + return + endif + + call writefile([ + \ 'hi CursorLine ctermbg=red ctermfg=white', + \ 'set cursorline', + \ 'call setline(1, ["foo","foo","foo","bar"])', + \ 'vnew', + \ 'call setline(1, ["bee","foo","foo","baz"])', + \ 'windo diffthis', + \ '2wincmd w', + \ ], 'Xtest_diff_cursorline') + let buf = RunVimInTerminal('-S Xtest_diff_cursorline', {}) + + call VerifyScreenDump(buf, 'Test_diff_with_cursorline_01', {}) + call term_sendkeys(buf, "j") + call VerifyScreenDump(buf, 'Test_diff_with_cursorline_02', {}) + call term_sendkeys(buf, "j") + call VerifyScreenDump(buf, 'Test_diff_with_cursorline_03', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtest_diff_cursorline') +endfunc diff --git a/src/version.c b/src/version.c index 717425afa..928a07ee8 100644 --- a/src/version.c +++ b/src/version.c @@ -793,6 +793,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 448, +/**/ 447, /**/ 446, |