Small bug fixes (#298)
fix: List remote branches for merge targets (#293) fix: consider remote branches (#297) fix: Save popup contents to temp_registers (#294) This is a #PATCH release.
This commit is contained in:
committed by
GitHub
parent
0d0ed1639a
commit
816b87cf91
@@ -188,28 +188,23 @@ M.create_comment_layout = function(opts)
|
|||||||
},
|
},
|
||||||
}, internal_layout)
|
}, internal_layout)
|
||||||
|
|
||||||
local popup_opts = {
|
|
||||||
action_before_close = true,
|
|
||||||
action_before_exit = false,
|
|
||||||
}
|
|
||||||
|
|
||||||
miscellaneous.set_cycle_popups_keymaps({ M.comment_popup, M.draft_popup })
|
miscellaneous.set_cycle_popups_keymaps({ M.comment_popup, M.draft_popup })
|
||||||
|
|
||||||
local range = opts.ranged and { start_line = M.start_line, end_line = M.end_line } or nil
|
local range = opts.ranged and { start_line = M.start_line, end_line = M.end_line } or nil
|
||||||
local unlinked = opts.unlinked or false
|
local unlinked = opts.unlinked or false
|
||||||
|
|
||||||
---Keybinding for focus on text section
|
---Keybinding for focus on draft section
|
||||||
state.set_popup_keymaps(M.draft_popup, function()
|
state.set_popup_keymaps(M.draft_popup, function()
|
||||||
local text = u.get_buffer_text(M.comment_popup.bufnr)
|
local text = u.get_buffer_text(M.comment_popup.bufnr)
|
||||||
confirm_create_comment(text, range, unlinked, opts.discussion_id)
|
confirm_create_comment(text, range, unlinked, opts.discussion_id)
|
||||||
vim.api.nvim_set_current_win(M.current_win)
|
vim.api.nvim_set_current_win(M.current_win)
|
||||||
end, miscellaneous.toggle_bool, popup_opts)
|
end, miscellaneous.toggle_bool, miscellaneous.non_editable_popup_opts)
|
||||||
|
|
||||||
---Keybinding for focus on draft section
|
---Keybinding for focus on text section
|
||||||
state.set_popup_keymaps(M.comment_popup, function(text)
|
state.set_popup_keymaps(M.comment_popup, function(text)
|
||||||
confirm_create_comment(text, range, unlinked, opts.discussion_id)
|
confirm_create_comment(text, range, unlinked, opts.discussion_id)
|
||||||
vim.api.nvim_set_current_win(M.current_win)
|
vim.api.nvim_set_current_win(M.current_win)
|
||||||
end, miscellaneous.attach_file, popup_opts)
|
end, miscellaneous.attach_file, miscellaneous.editable_popup_opts)
|
||||||
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local draft_mode = state.settings.discussion_tree.draft_mode
|
local draft_mode = state.settings.discussion_tree.draft_mode
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ end
|
|||||||
---@param tree NuiTree
|
---@param tree NuiTree
|
||||||
M.copy_node_url = function(tree)
|
M.copy_node_url = function(tree)
|
||||||
local url = M.get_url(tree)
|
local url = M.get_url(tree)
|
||||||
if url == nil then
|
if url ~= nil then
|
||||||
vim.fn.setreg("+", url)
|
vim.fn.setreg("+", url)
|
||||||
u.notify("Copied '" .. url .. "' to clipboard", vim.log.levels.INFO)
|
u.notify("Copied '" .. url .. "' to clipboard", vim.log.levels.INFO)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,9 +35,17 @@ M.attach_file = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
M.editable_popup_opts = {
|
M.editable_popup_opts = {
|
||||||
|
action_before_close = true,
|
||||||
|
action_before_exit = false,
|
||||||
save_to_temp_register = true,
|
save_to_temp_register = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M.non_editable_popup_opts = {
|
||||||
|
action_before_close = true,
|
||||||
|
action_before_exit = false,
|
||||||
|
save_to_temp_register = false,
|
||||||
|
}
|
||||||
|
|
||||||
-- Get the index of the next popup when cycling forward
|
-- Get the index of the next popup when cycling forward
|
||||||
local function next_index(i, n, count)
|
local function next_index(i, n, count)
|
||||||
count = count > 0 and count or 1
|
count = count > 0 and count or 1
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ M.summary = function()
|
|||||||
description_popup,
|
description_popup,
|
||||||
M.edit_summary,
|
M.edit_summary,
|
||||||
miscellaneous.attach_file,
|
miscellaneous.attach_file,
|
||||||
{ cb = exit, action_before_close = true }
|
{ cb = exit, action_before_close = true, save_to_temp_register = true }
|
||||||
)
|
)
|
||||||
state.set_popup_keymaps(title_popup, M.edit_summary, nil, { cb = exit, action_before_close = true })
|
state.set_popup_keymaps(title_popup, M.edit_summary, nil, { cb = exit, action_before_close = true })
|
||||||
state.set_popup_keymaps(info_popup, M.edit_summary, nil, { cb = exit, action_before_close = true })
|
state.set_popup_keymaps(info_popup, M.edit_summary, nil, { cb = exit, action_before_close = true })
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ local M = {}
|
|||||||
---@param command table
|
---@param command table
|
||||||
---@return string|nil, string|nil
|
---@return string|nil, string|nil
|
||||||
local run_system = function(command)
|
local run_system = function(command)
|
||||||
|
-- Load here to prevent loop
|
||||||
local u = require("gitlab.utils")
|
local u = require("gitlab.utils")
|
||||||
local result = vim.fn.trim(vim.fn.system(command))
|
local result = vim.fn.trim(vim.fn.system(command))
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
@@ -16,9 +17,12 @@ local run_system = function(command)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---Returns all branches for the current repository
|
---Returns all branches for the current repository
|
||||||
|
---@param args table|nil extra arguments for `git branch`
|
||||||
---@return string|nil, string|nil
|
---@return string|nil, string|nil
|
||||||
M.branches = function()
|
M.branches = function(args)
|
||||||
return run_system({ "git", "branch" })
|
-- Load here to prevent loop
|
||||||
|
local u = require("gitlab.utils")
|
||||||
|
return run_system(u.combine({ "git", "branch" }, args or {}))
|
||||||
end
|
end
|
||||||
|
|
||||||
---Checks whether the tree has any changes that haven't been pushed to the remote
|
---Checks whether the tree has any changes that haven't been pushed to the remote
|
||||||
@@ -60,7 +64,7 @@ end
|
|||||||
---Return the list of names of all remote-tracking branches or an empty list.
|
---Return the list of names of all remote-tracking branches or an empty list.
|
||||||
---@return table, string|nil
|
---@return table, string|nil
|
||||||
M.get_all_remote_branches = function()
|
M.get_all_remote_branches = function()
|
||||||
local all_branches, err = M.branches()
|
local all_branches, err = M.branches({ "--remotes" })
|
||||||
if err ~= nil then
|
if err ~= nil then
|
||||||
return {}, err
|
return {}, err
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user