fix(git_status): keep picker open with no matches (#2825)
Previously, `git_status` with a prompt that has zero matches closes the picker. Only automatically close the picker if working tree is completely clean. If working tree is not clean, and a prompt is given but no matches are found, keep the picker open. This behavior is consistent with other pickers where lack of matches doesn't result in the picker closing. closes #2815
This commit is contained in:
@@ -390,7 +390,14 @@ git.status = function(opts)
|
|||||||
on_complete = {
|
on_complete = {
|
||||||
function(self)
|
function(self)
|
||||||
local lines = self.manager:num_results()
|
local lines = self.manager:num_results()
|
||||||
if lines == 0 then
|
|
||||||
|
-- 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
|
||||||
utils.notify("builtin.git_status", {
|
utils.notify("builtin.git_status", {
|
||||||
msg = "No changes found",
|
msg = "No changes found",
|
||||||
level = "ERROR",
|
level = "ERROR",
|
||||||
|
|||||||
Reference in New Issue
Block a user