fix: pass in index to :CP panel <n>

This commit is contained in:
Barrett Ruth 2026-03-04 00:29:33 -05:00
parent f6b27b9089
commit 4affabcae3
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -2,6 +2,7 @@ local M = {}
---@class PanelOpts
---@field debug? boolean
---@field test_index? integer
local cache = require('cp.cache')
local config_module = require('cp.config')
@ -806,6 +807,13 @@ function M.toggle_panel(panel_opts)
return
end
if panel_opts and panel_opts.test_index then
local test_state = run.get_panel_state()
if panel_opts.test_index >= 1 and panel_opts.test_index <= #test_state.test_cases then
test_state.current_index = panel_opts.test_index
end
end
local io_state = state.get_io_view_state()
if io_state then
for _, win in ipairs(vim.api.nvim_list_wins()) do