* fix: Jumping to wrong buffer (#261)
* fix: Go to last line and show warning when diagnostic is past the end of buffer (#262)
* fix: Get recent pipeline through other means (#266)
* feat: Add keymaps and linewise actions to layouts (#265)

This is a #MINOR release, because we are introducing new keybindings for the comment/note popups.

---------

Co-authored-by: Jakub F. Bortlík <jakub.bortlik@proton.me>
Co-authored-by: sunfuze <sunfuze.1989@gmail.com>
This commit is contained in:
Harrison (Harry) Cramer
2024-04-15 09:56:21 -04:00
committed by GitHub
parent 138b96baea
commit f906af0c3a
20 changed files with 358 additions and 103 deletions

View File

@@ -93,9 +93,9 @@ end
-- Jumps to the location provided in the reviewer window
---@param file_name string
---@param new_line number|nil
---@param old_line number|nil
M.jump = function(file_name, new_line, old_line)
---@param line_number number
---@param new_buffer boolean
M.jump = function(file_name, line_number, new_buffer)
if M.tabnr == nil then
u.notify("Can't jump to Diffvew. Is it open?", vim.log.levels.ERROR)
return
@@ -115,13 +115,19 @@ M.jump = function(file_name, new_line, old_line)
async.await(view:set_file(file))
local layout = view.cur_layout
if old_line == nil then
local number_of_lines
if new_buffer then
layout.b:focus()
vim.api.nvim_win_set_cursor(0, { new_line, 0 })
number_of_lines = u.get_buffer_length(layout.b.file.bufnr)
else
layout.a:focus()
vim.api.nvim_win_set_cursor(0, { old_line, 0 })
number_of_lines = u.get_buffer_length(layout.a.file.bufnr)
end
if line_number > number_of_lines then
u.notify("Diagnostic position outside buffer. Jumping to last line instead.", vim.log.levels.WARN)
line_number = number_of_lines
end
vim.api.nvim_win_set_cursor(0, { line_number, 0 })
end
---Get the data from diffview, such as line information and file name. May be used by