Skip to content

Commit 0b88973

Browse files
committed
Make q close the Executor popup
Fixes #34.
1 parent 063bc7f commit 0b88973

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lua/executor/executor.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,22 @@ M._make_popup = function(title, lines)
194194
},
195195
})
196196

197+
M._popup:map("n", "q", function()
198+
M._popup:unmount()
199+
M._popup = nil
200+
M._state.showing_detail = false
201+
end, { noremap = true, silent = true })
202+
197203
M._popup:mount()
198204
Output.write_data(M._stored_task_command, M._popup.bufnr, M._settings.output_filter, lines)
199205

200206
-- Ensure if the user uses :q or similar to destroy it, that we tidy up.
201207
M._popup:on({ event.BufWinLeave }, function()
202208
vim.schedule(function()
209+
if M._popup == nil then
210+
-- If the user closed the popup, we don't need to do anything.
211+
return
212+
end
203213
M._popup:unmount()
204214
M._popup = nil
205215
M._state.showing_detail = false

0 commit comments

Comments
 (0)