Skip to content

Commit a4b9859

Browse files
authored
Fix: Force start_line for jumping to diagnostic to be inside buffer (#494)
1 parent cd06875 commit a4b9859

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lua/gitlab/actions/common.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ M.get_line_numbers_for_range = function(old_line, new_line, start_line_code, end
242242
return (old_line - range), old_line, false
243243
elseif new_line ~= nil then
244244
local range = new_end_line - new_start_line
245-
return (new_line - range), new_line, true
245+
-- Force start_line to be greater than 0
246+
local start_line = (new_line - range > 0) and (new_line - range) or 1
247+
return start_line, new_line, true
246248
else
247249
u.notify("Error getting new or old line for range", vim.log.levels.ERROR)
248250
return 1, 1, false

lua/gitlab/indicators/diagnostics.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ M.place_diagnostics = function(bufnr)
122122
u.notify("Could not find Diffview view", vim.log.levels.ERROR)
123123
return
124124
end
125+
if vim.api.nvim_buf_get_name(bufnr) == "diffview://null" then
126+
return
127+
end
125128

126129
local ok, err = pcall(function()
127130
local file_discussions = List.new(M.placeable_discussions):filter(function(discussion_or_note)

0 commit comments

Comments
 (0)