From 4affabcae399482616398e2c984fc834bced8107 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 4 Mar 2026 00:29:33 -0500 Subject: [PATCH] fix: pass in index to :CP panel --- lua/cp/ui/views.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/cp/ui/views.lua b/lua/cp/ui/views.lua index 0849164..5e658c4 100644 --- a/lua/cp/ui/views.lua +++ b/lua/cp/ui/views.lua @@ -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