aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-01-11 01:45:38 +0100
committerJustin M. Keyes <justinkz@gmail.com>2019-01-11 01:45:38 +0100
commit99429e5f415bfbb8298142c0e10b76a7ef9428bf (patch)
tree69dd0ea861367c08ee546d34cb82dff5b3051d7f
parent3f10c5b5338fc7efec53a23427e1c0e2dea56be4 (diff)
parent56dec2a3a04a834652c8e118871d63a9328e3af5 (diff)
downloadrneovim-99429e5f415bfbb8298142c0e10b76a7ef9428bf.tar.gz
rneovim-99429e5f415bfbb8298142c0e10b76a7ef9428bf.tar.bz2
rneovim-99429e5f415bfbb8298142c0e10b76a7ef9428bf.zip
Merge #9481 'vim-patch:8.1.0449,8.1.0450'
closes #9481
-rw-r--r--src/nvim/screen.c7
-rw-r--r--src/nvim/testdir/test_fold.vim20
-rw-r--r--test/functional/ui/fold_spec.lua22
3 files changed, 48 insertions, 1 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 27d72ffbf7..513f8dac9a 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1409,7 +1409,12 @@ 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);
+ } 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'])
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 39a5c10bb7..943cbcef56 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -1,8 +1,10 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq
+local command = helpers.command
local feed_command = helpers.feed_command
local insert = helpers.insert
+local funcs = helpers.funcs
local meths = helpers.meths
describe("folded lines", function()
@@ -26,6 +28,26 @@ describe("folded lines", function()
screen:detach()
end)
+ it("highlighting with relative line numbers", function()
+ command("set relativenumber foldmethod=marker")
+ feed_command("set foldcolumn=2")
+ funcs.setline(1, '{{{1')
+ funcs.setline(2, 'line 1')
+ funcs.setline(3, '{{{1')
+ funcs.setline(4, 'line 2')
+ feed("j")
+ screen:expect([[
+ {7:+ }{5: 1 +-- 2 lines: ·························}|
+ {7:+ }{5: 0 ^+-- 2 lines: ·························}|
+ {7: }{1:~ }|
+ {7: }{1:~ }|
+ {7: }{1:~ }|
+ {7: }{1:~ }|
+ {7: }{1:~ }|
+ :set foldcolumn=2 |
+ ]])
+ end)
+
it("works with multibyte text", function()
-- Currently the only allowed value of 'maxcombine'
eq(6, meths.get_option('maxcombine'))