refactor(git_status): clean up prompt retrieval for on_complete (#2829)

relevant #2825
This commit is contained in:
James Trew
2023-12-26 15:54:54 -05:00
committed by GitHub
parent ae6708a90b
commit c0ee29e8e4

View File

@@ -390,13 +390,7 @@ git.status = function(opts)
on_complete = { on_complete = {
function(self) function(self)
local lines = self.manager:num_results() local lines = self.manager:num_results()
local prompt = action_state.get_current_line()
-- HACK: unable to `self._get_prompt()` directly
local cursor_line = vim.api.nvim_win_get_cursor(self.prompt_win)[1] - 1
local prompt = vim.api
.nvim_buf_get_lines(self.prompt_bufnr, cursor_line, cursor_line + 1, false)[1]
:sub(#self.prompt_prefix + 1)
if lines == 0 and prompt == "" then if lines == 0 and prompt == "" then
utils.notify("builtin.git_status", { utils.notify("builtin.git_status", {
msg = "No changes found", msg = "No changes found",