Skip to content

Commit

Permalink
fix: dont advance two items at a time. Fixes folke/todo-comments.nvim#39
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 24, 2021
1 parent a2a7dbf commit 7de8bc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lua/trouble/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,11 @@ function Trouble.action(action)
end
if action == "next" then
view:next_item()
return Trouble
end
if action == "previous" then
view:previous_item()
return Trouble
end

if action == "toggle_preview" then
Expand Down
4 changes: 2 additions & 2 deletions lua/trouble/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ function View:next_item(opts)
opts = opts or { skip_groups = false }
local line = self:get_line()
for i = line + 1, vim.api.nvim_buf_line_count(self.buf), 1 do
if self.items[i] and (not opts.skip_groups or not self.items[i].is_file) then
if self.items[i] and not (opts.skip_groups and self.items[i].is_file) then
vim.api.nvim_win_set_cursor(self.win, { i, self:get_col() })
if opts.jump then
self:jump()
Expand All @@ -380,7 +380,7 @@ function View:previous_item(opts)
opts = opts or { skip_groups = false }
local line = self:get_line()
for i = line - 1, 0, -1 do
if self.items[i] and (not opts.skip_groups or not self.items[i].is_file) then
if self.items[i] and not (opts.skip_groups and self.items[i].is_file) then
vim.api.nvim_win_set_cursor(self.win, { i, self:get_col() })
if opts.jump then
self:jump()
Expand Down

0 comments on commit 7de8bc4

Please sign in to comment.