diff options
author | Matthieu Coudron <teto@users.noreply.github.com> | 2020-11-29 14:26:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-29 14:26:59 +0100 |
commit | 15e616a057a2412add6bb7adc369a2d97e20356d (patch) | |
tree | 4e6cbbac3be1528f75848ebcc4cbdd63f5d22864 | |
parent | dc6593a84a9d4d9c9dc2533e84c83c876b2e0155 (diff) | |
download | rneovim-15e616a057a2412add6bb7adc369a2d97e20356d.tar.gz rneovim-15e616a057a2412add6bb7adc369a2d97e20356d.tar.bz2 rneovim-15e616a057a2412add6bb7adc369a2d97e20356d.zip |
folds: use Folded highlight even with spell on (#13393)
the highlight was not used with spell enabled on folded lines.
Thanks to lervag for the nice report.
-rw-r--r-- | src/nvim/screen.c | 4 | ||||
-rw-r--r-- | test/functional/ui/fold_spec.lua | 38 |
2 files changed, 33 insertions, 9 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 4373d6d5a8..2eeeebb88d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2550,7 +2550,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, */ cur = wp->w_match_head; shl_flag = false; - while ((cur != NULL || !shl_flag) && !number_only) { + while ((cur != NULL || !shl_flag) && !number_only + && foldinfo.fi_lines == 0 + ) { if (!shl_flag) { shl = &search_hl; shl_flag = true; diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 018049d2f4..7b05e90459 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -9,6 +9,15 @@ local meths = helpers.meths local source = helpers.source local assert_alive = helpers.assert_alive + +local content1 = [[ + This is a + valid English + sentence composed by + an exhausted developer + in his cave. + ]] + describe("folded lines", function() before_each(function() clear() @@ -119,18 +128,31 @@ describe("folded lines", function() it("work with spell", function() command("set spell") - insert([[ - This is a - valid English - sentence composed by - an exhausted developer - in his cave. - ]]) + insert(content1) + + feed("gg") + feed("zf3j") + if not multigrid then + screen:expect{grid=[[ + {5:^+-- 4 lines: This is a······················}| + in his cave. | + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + end + end) + it("work with matches", function() + insert(content1) + command("highlight MyWord gui=bold guibg=red guifg=white") + command("call matchadd('MyWord', '\\V' . 'test', -1)") feed("gg") feed("zf3j") if not multigrid then - -- screen:snapshot_util() screen:expect{grid=[[ {5:^+-- 4 lines: This is a······················}| in his cave. | |