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('')