mirror of
https://github.com/kevinhwang91/nvim-ufo
synced 2024-09-16 14:14:02 +02:00
fix(preview): must return empty kind because of diff or marker foldmethod
This commit is contained in:
parent
9a12997518
commit
f0ae3c77d9
2 changed files with 7 additions and 2 deletions
|
@ -94,9 +94,13 @@ function FoldBuffer:foldedLine(lnum)
|
|||
end
|
||||
|
||||
---
|
||||
---@param winid number
|
||||
---@param lnum number 1-index
|
||||
---@return UfoFoldingRangeKind|''
|
||||
function FoldBuffer:lineKind(lnum)
|
||||
function FoldBuffer:lineKind(winid, lnum)
|
||||
if utils.isDiffOrMarkerFold(winid) then
|
||||
return ''
|
||||
end
|
||||
local row = lnum - 1
|
||||
for _, range in ipairs(self.foldRanges) do
|
||||
if row >= range.startLine and row <= range.endLine then
|
||||
|
|
|
@ -192,7 +192,8 @@ function Preview:peekFoldedLinesUnderCursor(enter, nextLineIncluded)
|
|||
if utils.isBufLoaded(floatwin.bufnr) then
|
||||
api.nvim_buf_clear_namespace(floatwin.bufnr, self.ns, 0, -1)
|
||||
end
|
||||
local kind = fb:lineKind(lnum)
|
||||
local curWinid = api.nvim_get_current_win()
|
||||
local kind = fb:lineKind(curWinid, lnum)
|
||||
local isAbove = kind == 'comment'
|
||||
if not isAbove and nextLineIncluded ~= false then
|
||||
endLnum = fb:lineCount() == endLnum and endLnum or (endLnum + 1)
|
||||
|
|
Loading…
Reference in a new issue