Closed ldelossa closed 2 years ago
The ultimate issue here is the function M.get_sorted_lines
is receiving a nil bufnr
and it does not get checked.
The following diff seems to fix the issue. LMK if this looks correct
diff --git a/lua/octo/navigation.lua b/lua/octo/navigation.lua
index b01e2c8..888ad25 100644
--- a/lua/octo/navigation.lua
+++ b/lua/octo/navigation.lua
@@ -98,7 +98,7 @@ function M.next_comment()
if buffer.kind then
local cursor = vim.api.nvim_win_get_cursor(0)
local current_line = cursor[1]
- local lines = utils.get_sorted_comment_lines()
+ local lines = utils.get_sorted_comment_lines(bufnr)
if not buffer:isReviewThread() then
-- skil title and body
lines = utils.tbl_slice(lines, 3, #lines)
@@ -131,7 +131,7 @@ function M.prev_comment()
if buffer.kind then
local cursor = vim.api.nvim_win_get_cursor(0)
local current_line = cursor[1]
- local lines = utils.get_sorted_comment_lines()
+ local lines = utils.get_sorted_comment_lines(bufnr)
lines = utils.tbl_slice(lines, 3, #lines)
if not lines or not current_line then
return
Thanks for reporting the issue and for the patch!
Anytime :)
Issue Description
Type: bug report
Describe what happened (or what feature you want)
When using the navigation.next_comment method in the PR view an error is returned:
Describe what you expected to happen
You open a PR and then use the
navigation.next_comment
method. It does not move to the next comment nor does it gracefully handle the error case.How to reproduce it (as minimally and precisely as possible)
Tell us your environment
Fedora 35, Neovim nightly.