Popup and Keymap Updates (#356)
feat: Enable always jumping to discussion tree (#352) feat: Enables motions for easier range selection when creating comments/suggestions (e.g. s3j, c3j) (#353) fix: Makes help popup not editable and close it on BufLeave (#355) This is a #MINOR release
This commit is contained in:
committed by
GitHub
parent
4ae623cd65
commit
6500ef1f2c
@@ -202,7 +202,12 @@ M.move_to_discussion_tree = function()
|
||||
end
|
||||
|
||||
if #d == 0 then
|
||||
u.notify("No diagnostics for this line", vim.log.levels.WARN)
|
||||
if state.settings.reviewer_settings.jump_with_no_diagnostics then
|
||||
vim.api.nvim_win_set_cursor(M.split.winid, { M.last_row, M.last_column })
|
||||
vim.api.nvim_set_current_win(M.split.winid)
|
||||
else
|
||||
u.notify("No diagnostics for this line.", vim.log.levels.WARN)
|
||||
end
|
||||
return
|
||||
elseif #d > 1 then
|
||||
vim.ui.select(d, {
|
||||
@@ -518,6 +523,13 @@ M.create_split_and_bufs = function()
|
||||
local linked_bufnr = vim.api.nvim_create_buf(true, false)
|
||||
local unlinked_bufnr = vim.api.nvim_create_buf(true, false)
|
||||
|
||||
vim.api.nvim_create_autocmd("WinLeave", {
|
||||
buffer = linked_bufnr,
|
||||
callback = function()
|
||||
M.last_row, M.last_column = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
end,
|
||||
})
|
||||
|
||||
return split, linked_bufnr, unlinked_bufnr
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local M = {}
|
||||
|
||||
local u = require("gitlab.utils")
|
||||
local event = require("nui.utils.autocmd").event
|
||||
local state = require("gitlab.state")
|
||||
local List = require("gitlab.utils.list")
|
||||
local Popup = require("nui.popup")
|
||||
@@ -18,11 +19,15 @@ M.open = function()
|
||||
local longest_line = u.get_longest_string(help_content_lines)
|
||||
local help_popup =
|
||||
Popup(u.create_popup_state("Help", state.settings.popup.help, longest_line + 3, #help_content_lines + 3, 60))
|
||||
help_popup:on(event.BufLeave, function()
|
||||
help_popup:unmount()
|
||||
end)
|
||||
help_popup:mount()
|
||||
|
||||
state.set_popup_keymaps(help_popup, "Help", nil)
|
||||
local currentBuffer = vim.api.nvim_get_current_buf()
|
||||
vim.api.nvim_buf_set_lines(currentBuffer, 0, #help_content_lines, false, help_content_lines)
|
||||
u.switch_can_edit_buf(currentBuffer, false)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user