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.
This commit is contained in:
Matthieu Coudron
2020-11-29 14:26:59 +01:00
committed by GitHub
parent dc6593a84a
commit 15e616a057
2 changed files with 33 additions and 9 deletions

View File

@@ -2550,7 +2550,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
*/ */
cur = wp->w_match_head; cur = wp->w_match_head;
shl_flag = false; shl_flag = false;
while ((cur != NULL || !shl_flag) && !number_only) { while ((cur != NULL || !shl_flag) && !number_only
&& foldinfo.fi_lines == 0
) {
if (!shl_flag) { if (!shl_flag) {
shl = &search_hl; shl = &search_hl;
shl_flag = true; shl_flag = true;

View File

@@ -9,6 +9,15 @@ local meths = helpers.meths
local source = helpers.source local source = helpers.source
local assert_alive = helpers.assert_alive 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() describe("folded lines", function()
before_each(function() before_each(function()
clear() clear()
@@ -119,18 +128,31 @@ describe("folded lines", function()
it("work with spell", function() it("work with spell", function()
command("set spell") command("set spell")
insert([[ insert(content1)
This is a
valid English
sentence composed by
an exhausted developer
in his cave.
]])
feed("gg") feed("gg")
feed("zf3j") feed("zf3j")
if not multigrid then if not multigrid then
-- screen:snapshot_util() 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:expect{grid=[[ screen:expect{grid=[[
{5:^+-- 4 lines: This is a······················}| {5:^+-- 4 lines: This is a······················}|
in his cave. | in his cave. |