mirror of
https://github.com/kevinhwang91/nvim-ufo
synced 2024-09-16 14:14:02 +02:00
fix(decorator): open fold should redraw at once (#132)
This commit is contained in:
parent
9e829d5cfa
commit
138b39f5b2
2 changed files with 7 additions and 4 deletions
|
@ -72,8 +72,9 @@ local function onEnd(name, tick)
|
|||
local bufnr = data.bufnr
|
||||
local fb = fold.get(bufnr)
|
||||
utils.winCall(winid, function()
|
||||
local folded = self:computeFoldedLnums(fb, winid, data.rows)
|
||||
log.debug('folded lnum:', folded)
|
||||
local folded
|
||||
folded, needRedraw = self:computeFoldedLnums(fb, winid, data.rows)
|
||||
log.debug('folded lnums:', folded, 'didOpen:', needRedraw)
|
||||
if #folded == 0 then
|
||||
self:clearCursorFoldedLineHighlight(bufnr, winid)
|
||||
return
|
||||
|
@ -228,7 +229,7 @@ function Decorator:computeFoldedLnums(fb, winid, rows)
|
|||
if didOpen then
|
||||
fb:syncFoldedLines(winid)
|
||||
end
|
||||
return folded
|
||||
return folded, didOpen
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
|
|
|
@ -189,13 +189,15 @@ end
|
|||
---@param lnum number
|
||||
---@return boolean
|
||||
function FoldBuffer:openFold(lnum)
|
||||
local folded = false
|
||||
local fl = self.foldedLines[lnum]
|
||||
if fl then
|
||||
folded = self.foldedLines[lnum] ~= nil
|
||||
fl:deleteVirtText()
|
||||
self.foldedLineCount = self.foldedLineCount - 1
|
||||
self.foldedLines[lnum] = false
|
||||
end
|
||||
return fl ~= nil
|
||||
return folded
|
||||
end
|
||||
|
||||
---
|
||||
|
|
Loading…
Reference in a new issue