mirror of
https://github.com/gosticks/bookmarks.nvim.git
synced 2025-10-16 11:55:38 +00:00
fix: adding signs outside buffer len
If a mark was added and the file length was decreased afterwards adding signs would fail with an out of bounds error for marks in outside of the new bounds
This commit is contained in:
parent
db4899640d
commit
26d0eb7924
@ -28,12 +28,13 @@ end
|
||||
function M:add(bufnr, signs)
|
||||
local cfg = self.config
|
||||
local isExt = true
|
||||
local line_count = api.nvim_buf_line_count(bufnr)
|
||||
for _, s in ipairs(signs) do
|
||||
if s.lnum >= 1 and s.lnum <= line_count then
|
||||
if not self:contains(bufnr, s.lnum) then
|
||||
isExt = false
|
||||
local cs = cfg[s.type]
|
||||
local text = s.text or cs.text
|
||||
|
||||
api.nvim_buf_set_extmark(bufnr, self.ns, s.lnum - 1, -1, {
|
||||
id = s.lnum,
|
||||
sign_text = text,
|
||||
@ -44,6 +45,7 @@ function M:add(bufnr, signs)
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
return isExt
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user