fix: correcting some problem with review mode (#225)
Addresses issues where the new and old lines were not being set correctly
This commit is contained in:
@@ -392,20 +392,17 @@ end
|
||||
---@param node any
|
||||
---@return number|nil
|
||||
local function get_new_line(node)
|
||||
if node.new_line == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
---@type GitlabLineRange|nil
|
||||
local range = node.range
|
||||
if range == nil then
|
||||
if node.new_line == nil then
|
||||
return nil
|
||||
end
|
||||
return node.new_line
|
||||
end
|
||||
|
||||
local start_new_line, _ = common.parse_line_code(range.start.line_code)
|
||||
if range.start.new_line ~= nil then
|
||||
return range.start.new_line
|
||||
end
|
||||
|
||||
local _, start_new_line = common.parse_line_code(range.start.line_code)
|
||||
return start_new_line
|
||||
end
|
||||
|
||||
@@ -414,17 +411,17 @@ end
|
||||
---@param node any
|
||||
---@return number|nil
|
||||
local function get_old_line(node)
|
||||
if node.old_line == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
---@type GitlabLineRange|nil
|
||||
local range = node.range
|
||||
if range == nil then
|
||||
return node.old_line
|
||||
end
|
||||
|
||||
local _, start_old_line = common.parse_line_code(range.start.line_code)
|
||||
if range.start.old_line ~= nil then
|
||||
return range.start.old_line
|
||||
end
|
||||
|
||||
local start_old_line, _ = common.parse_line_code(range.start.line_code)
|
||||
return start_old_line
|
||||
end
|
||||
|
||||
@@ -453,7 +450,7 @@ M.jump_to_file = function(tree)
|
||||
if line_number == nil then
|
||||
line_number = 1
|
||||
end
|
||||
local bufnr = vim.fn.bufnr(root_node.filename)
|
||||
local bufnr = vim.fn.bufnr(root_node.file_name)
|
||||
if bufnr ~= -1 then
|
||||
vim.cmd("buffer " .. bufnr)
|
||||
vim.api.nvim_win_set_cursor(0, { line_number, 0 })
|
||||
@@ -461,7 +458,7 @@ M.jump_to_file = function(tree)
|
||||
end
|
||||
|
||||
-- If buffer is not already open, open it
|
||||
vim.cmd("edit " .. root_node.filename)
|
||||
vim.cmd("edit " .. root_node.file_name)
|
||||
vim.api.nvim_win_set_cursor(0, { line_number, 0 })
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user