From a4e566019a512715aea0a519094c94c80c3aa20d Mon Sep 17 00:00:00 2001 From: chenchen Date: Sun, 17 May 2026 13:38:59 +0800 Subject: [PATCH] fix(desktop): correct @ file search replacement in EmptySession MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same bug as ChatInput — inserting filename at cursor without removing the @filter trigger text, producing @foofile.ts instead of file.ts. Co-Authored-By: Claude Opus 4.6 --- cc-haha/desktop/src/pages/EmptySession.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cc-haha/desktop/src/pages/EmptySession.tsx b/cc-haha/desktop/src/pages/EmptySession.tsx index 8880788..f47902c 100644 --- a/cc-haha/desktop/src/pages/EmptySession.tsx +++ b/cc-haha/desktop/src/pages/EmptySession.tsx @@ -484,8 +484,9 @@ export function EmptySession() { filter={atFilter} onSelect={(_path, name) => { if (atCursorPos >= 0) { - const newValue = `${input.slice(0, atCursorPos)}${name}${input.slice(atCursorPos)}` - const newCursorPos = atCursorPos + name.length + const atStart = atCursorPos - atFilter.length - 1 + const newValue = `${input.slice(0, atStart)}${name}${input.slice(atCursorPos)}` + const newCursorPos = atStart + name.length setInput(newValue) setFileSearchOpen(false) setAtFilter('')