Skip to content

Commit

Permalink
fix(decorator): setl winhl erase hl of nvim_win_set_hl_ns (kevinh…
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhwang91 committed Feb 3, 2023
1 parent eedf7a4 commit a106199
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lua/ufo/decorator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,21 @@ end
function Decorator:setCursorFoldedLineHighlight(bufnr, winid, curLnum)
local session = self.winSessionTbl[winid]
if session.bufnr ~= bufnr or session.curFoldedLine == 0 then
cmd('setl winhl+=CursorLine:UfoCursorFoldedLine')
local winhl = vim.wo[winid].winhl
if not winhl:find('UfoCursorFoldedLine', 1, true) then
cmd('setl winhl+=CursorLine:UfoCursorFoldedLine')
end
session.curFoldedLine = curLnum
end
end

function Decorator:clearCursorFoldedLineHighlight(bufnr, winid)
local session = self.winSessionTbl[winid]
if session.bufnr ~= bufnr or session.curFoldedLine > 0 then
cmd('setl winhl-=CursorLine:UfoCursorFoldedLine')
local winhl = vim.wo[winid].winhl
if winhl:find('UfoCursorFoldedLine', 1, true) then
cmd('setl winhl-=CursorLine:UfoCursorFoldedLine')
end
session.curFoldedLine = 0
end
end
Expand Down

0 comments on commit a106199

Please sign in to comment.