diff options
author | Michael Vilim <697a9b924bfa6f06a81e82975ddca4785b90a7b40d91044ce76f68d3bd65a9b8@697a9b924bfa6f06a81e82975ddca4785b90a7b40d91044ce76f68d3bd65a9b8.com> | 2019-01-09 11:42:50 -0600 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-01-11 01:44:15 +0100 |
commit | bed95b37b29889d1d0edbcb70fd0bf6814d9a574 (patch) | |
tree | a4f01b2c2d382b682a38156900933f752101af46 /src | |
parent | 3f10c5b5338fc7efec53a23427e1c0e2dea56be4 (diff) | |
download | rneovim-bed95b37b29889d1d0edbcb70fd0bf6814d9a574.tar.gz rneovim-bed95b37b29889d1d0edbcb70fd0bf6814d9a574.tar.bz2 rneovim-bed95b37b29889d1d0edbcb70fd0bf6814d9a574.zip |
vim-patch:8.1.0449: fix display of 'rnu' with folded lines #9481
Problem: When 'rnu' is set folded lines are not displayed correctly.
(Vitaly Yashin)
Solution: When only redrawing line numbers do draw folded lines.
(closes vim/vim#3484)
https://github.com/vim/vim/commit/7701f308565fdc7b5096a6597d9c3b63de0bbcec
---
Explanation:
Before this patch, relative line numbers would update on a cursor
movement and overwrite fold highlighting in the line number columns.
Other operations can cause the fold highlighting to overwrite the line
number styles. Together, this causes the highlighting in the line number
columns to flicker back and forth while editing.
Test case: create `t.vim` with these contents:
set fdm=marker rnu foldcolumn=2
call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])
and then call `nvim -u NORC -S t.vim` and press `j`; observe that the fold
highlighting disappears.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/screen.c | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_fold.vim | 20 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 27d72ffbf7..56ca4ad4b6 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1409,7 +1409,13 @@ static void win_update(win_T *wp) if (wp->w_p_rnu) { // 'relativenumber' set: The text doesn't need to be drawn, but // the number column nearly always does. - (void)win_line(wp, lnum, srow, wp->w_grid.Rows, true, true); + fold_count = foldedCount(wp, lnum, &win_foldinfo); + if (fold_count != 0) { + fold_line(wp, fold_count, &win_foldinfo, lnum, row); + --fold_count; + } else { + (void)win_line(wp, lnum, srow, wp->w_grid.Rows, true, true); + } } // This line does not need to be drawn, advance to the next one. diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim index 0b4b5d1922..df3d691d85 100644 --- a/src/nvim/testdir/test_fold.vim +++ b/src/nvim/testdir/test_fold.vim @@ -704,6 +704,26 @@ func Test_fold_last_line_with_pagedown() enew! endfunc +func Test_folds_with_rnu() + if !CanRunVimInTerminal() + return + endif + + call writefile([ + \ 'set fdm=marker rnu foldcolumn=2', + \ 'call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])', + \ ], 'Xtest_folds_with_rnu') + let buf = RunVimInTerminal('-S Xtest_folds_with_rnu', {}) + + call VerifyScreenDump(buf, 'Test_folds_with_rnu_01', {}) + call term_sendkeys(buf, "j") + call VerifyScreenDump(buf, 'Test_folds_with_rnu_02', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtest_folds_with_rnu') +endfunc + func Test_folds_marker_in_comment2() new call setline(1, ['Lorem ipsum dolor sit', 'Lorem ipsum dolor sit', 'Lorem ipsum dolor sit']) |