fix(desktop): correct @ file search replacement in EmptySession

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 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 13:38:59 +08:00
co-authored by Claude Opus 4.6
parent 2172045a7a
commit a4e566019a
+3 -2
View File
@@ -484,8 +484,9 @@ export function EmptySession() {
filter={atFilter} filter={atFilter}
onSelect={(_path, name) => { onSelect={(_path, name) => {
if (atCursorPos >= 0) { if (atCursorPos >= 0) {
const newValue = `${input.slice(0, atCursorPos)}${name}${input.slice(atCursorPos)}` const atStart = atCursorPos - atFilter.length - 1
const newCursorPos = atCursorPos + name.length const newValue = `${input.slice(0, atStart)}${name}${input.slice(atCursorPos)}`
const newCursorPos = atStart + name.length
setInput(newValue) setInput(newValue)
setFileSearchOpen(false) setFileSearchOpen(false)
setAtFilter('') setAtFilter('')