add quick help within detail-float
This commit is contained in:
@@ -43,6 +43,43 @@ local function disable_container_maps(buf)
|
||||
vim.keymap.set("n", "<C-k>", "<Nop>", opts)
|
||||
end
|
||||
|
||||
local function help_lines()
|
||||
return {
|
||||
"Test-Samurai Help",
|
||||
"",
|
||||
"TSam Commands:",
|
||||
" TSamNearest <leader>tn",
|
||||
" TSamFile <leader>tf",
|
||||
" TSamAll <leader>ta",
|
||||
" TSamLast <leader>tl",
|
||||
" TSamFailedOnly <leader>te",
|
||||
" TSamShowOutput <leader>to",
|
||||
"",
|
||||
"Standard Keymaps:",
|
||||
" <leader>qn Close floats + jump to first quickfix entry",
|
||||
" <leader>nf Next [ FAIL ] in listing",
|
||||
" <leader>pf Previous [ FAIL ] in listing",
|
||||
"",
|
||||
"Testing-Float (Listing):",
|
||||
" <cr> Open Detail-Float for selected test",
|
||||
" <esc><esc> Close Testing-Float",
|
||||
" <C-l> Focus Detail-Float (press l again for full)",
|
||||
" <C-h> Focus Test-Listing-Float",
|
||||
" <leader>z Toggle Detail-Float full width",
|
||||
" <leader>o Jump to test location",
|
||||
" ? Show this help",
|
||||
"",
|
||||
"Testing-Float (Detail):",
|
||||
" <esc><esc> Close Testing-Float",
|
||||
" <C-h> Focus Test-Listing-Float",
|
||||
" <C-w>h Focus Test-Listing-Float",
|
||||
" <C-l> Focus Detail-Float",
|
||||
" <leader>z Toggle Detail-Float full width",
|
||||
" <C-c> Close Detail-Float",
|
||||
" ? Show this help",
|
||||
}
|
||||
end
|
||||
|
||||
local function get_hardtime()
|
||||
local ok, hardtime = pcall(require, "hardtime")
|
||||
if not ok or type(hardtime) ~= "table" then
|
||||
@@ -626,6 +663,9 @@ local function create_output_win(initial_lines)
|
||||
vim.keymap.set("n", "<leader>qn", function()
|
||||
jump_to_first_quickfix()
|
||||
end, { buffer = buf, nowait = true, silent = true })
|
||||
vim.keymap.set("n", "?", function()
|
||||
M.show_help()
|
||||
end, { buffer = buf, nowait = true, silent = true })
|
||||
disable_container_maps(buf)
|
||||
|
||||
state.last_win = listing
|
||||
@@ -690,6 +730,9 @@ local function reopen_output_win()
|
||||
vim.keymap.set("n", "<leader>qn", function()
|
||||
jump_to_first_quickfix()
|
||||
end, { buffer = state.last_buf, nowait = true, silent = true })
|
||||
vim.keymap.set("n", "?", function()
|
||||
M.show_help()
|
||||
end, { buffer = state.last_buf, nowait = true, silent = true })
|
||||
disable_container_maps(state.last_buf)
|
||||
|
||||
state.last_win = win
|
||||
@@ -1005,6 +1048,9 @@ local function ensure_detail_buf(lines)
|
||||
vim.keymap.set("n", "<leader>qn", function()
|
||||
jump_to_first_quickfix()
|
||||
end, { buffer = buf, nowait = true, silent = true })
|
||||
vim.keymap.set("n", "?", function()
|
||||
M.show_help()
|
||||
end, { buffer = buf, nowait = true, silent = true })
|
||||
disable_container_maps(buf)
|
||||
end
|
||||
local clean_lines, highlights = parse_ansi_lines(normalize_output_lines(lines))
|
||||
@@ -1133,6 +1179,14 @@ function M.open_test_output_at_cursor()
|
||||
open_detail_split(output, border_kind)
|
||||
end
|
||||
|
||||
function M.show_help()
|
||||
if not (state.last_win and vim.api.nvim_win_is_valid(state.last_win)) then
|
||||
vim.notify("[test-samurai] No test output window", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
open_detail_split(help_lines(), "default")
|
||||
end
|
||||
|
||||
function M.focus_listing()
|
||||
if state.last_win and vim.api.nvim_win_is_valid(state.last_win) then
|
||||
if state.detail_win and vim.api.nvim_win_is_valid(state.detail_win) then
|
||||
|
||||
Reference in New Issue
Block a user