From 4f307e323d0b4efea1edc7c6c3b43393a00bab8d Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 7 Mar 2026 02:32:52 -0500 Subject: [PATCH] fix(config): avoid doubling slug in `default_filename` for single-problem mode Problem: Kattis single-problem mode sets both `contest_id` and `problem_id` to the same slug, causing `default_filename` to concatenate them (e.g. `addtwonumbersaddtwonumbers.cc`). Solution: only concatenate when `problem_id ~= contest_id`; otherwise return just `problem_id` (or `contest_id` if nil). --- lua/cp/config.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/cp/config.lua b/lua/cp/config.lua index 74a40b7..2291101 100644 --- a/lua/cp/config.lua +++ b/lua/cp/config.lua @@ -605,10 +605,10 @@ end ---@param problem_id? string ---@return string local function default_filename(contest_id, problem_id) - if problem_id then + if problem_id and problem_id ~= contest_id then return (contest_id .. problem_id):lower() end - return contest_id:lower() + return (problem_id or contest_id):lower() end M.default_filename = default_filename