Skip to content

Commit

Permalink
folds: use Folded highlight even with spell on (neovim#13393)
Browse files Browse the repository at this point in the history
the highlight was not used with spell enabled on folded lines.
Thanks to lervag for the nice report.
  • Loading branch information
teto authored and shade-of-noon committed Nov 29, 2020
1 parent 84b47a9 commit 0e0e89d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/nvim/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
38 changes: 30 additions & 8 deletions test/functional/ui/fold_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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. |
Expand Down

0 comments on commit 0e0e89d

Please sign in to comment.