normalize scraper behavior

This commit is contained in:
Barrett Ruth 2025-10-04 16:13:04 -04:00
parent 91c37e35e5
commit 3fbbfa9423
6 changed files with 22 additions and 45 deletions

View file

@ -105,7 +105,7 @@ function M.set_contest_data(platform, contest_id, problems)
local out = {
name = prev.name,
display_name = prev.display_name,
problems = vim.deepcopy(problems),
problems = problems,
index_map = {},
}
for i, p in ipairs(out.problems) do

View file

@ -19,8 +19,6 @@
---@class RunPanelConfig
---@field ansi boolean Enable ANSI color parsing and highlighting
---@field diff_mode "none"|"vim"|"git" Diff backend to use
---@field next_test_key string Key to navigate to next test case
---@field prev_test_key string Key to navigate to previous test case
---@field max_output_lines number Maximum lines of test output to display
---@class DiffGitConfig
@ -90,8 +88,6 @@ M.defaults = {
run_panel = {
ansi = true,
diff_mode = 'none',
next_test_key = '<c-n>',
prev_test_key = '<c-p>',
max_output_lines = 50,
},
diff = {
@ -196,20 +192,6 @@ function M.setup(user_config)
end,
"diff_mode must be 'none', 'vim', or 'git'",
},
next_test_key = {
config.run_panel.next_test_key,
function(value)
return type(value) == 'string' and value ~= ''
end,
'next_test_key must be a non-empty string',
},
prev_test_key = {
config.run_panel.prev_test_key,
function(value)
return type(value) == 'string' and value ~= ''
end,
'prev_test_key must be a non-empty string',
},
max_output_lines = {
config.run_panel.max_output_lines,
function(value)

View file

@ -18,12 +18,7 @@ function M.set_platform(platform)
return false
end
if state.get_platform() == platform then
logger.log(('platform already set to %s'):format(platform))
else
state.set_platform(platform)
logger.log(('platform set to %s'):format(platform))
end
state.set_platform(platform)
return true
end

View file

@ -273,21 +273,14 @@ function M.toggle_run_panel(is_debug)
config.run_panel.diff_mode = modes[(current_idx % #modes) + 1]
refresh_run_panel()
end, { buffer = buf, silent = true })
vim.keymap.set('n', config.run_panel.next_test_key, function()
vim.keymap.set('n', '<c-n>', function()
navigate_test_case(1)
end, { buffer = buf, silent = true })
vim.keymap.set('n', config.run_panel.prev_test_key, function()
vim.keymap.set('n', '<c-p>', function()
navigate_test_case(-1)
end, { buffer = buf, silent = true })
end
vim.keymap.set('n', config.run_panel.next_test_key, function()
navigate_test_case(1)
end, { buffer = test_buffers.tab_buf, silent = true })
vim.keymap.set('n', config.run_panel.prev_test_key, function()
navigate_test_case(-1)
end, { buffer = test_buffers.tab_buf, silent = true })
setup_keybindings_for_buffer(test_buffers.tab_buf)
local execute = require('cp.runner.execute')