fix(desktop): correct @ file search replacement in ChatInput
The onSelect handler inserted the filename at cursor position without removing the @filter trigger text, producing "@foofilename.ts" instead of replacing the whole "@foo" with "filename.ts". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -562,9 +562,9 @@ export function ChatInput({ variant = 'default' }: ChatInputProps) {
|
||||
filter={atFilter}
|
||||
onSelect={(_path, name) => {
|
||||
if (atCursorPos >= 0) {
|
||||
// Insert name at cursor position, replacing filter text
|
||||
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('')
|
||||
|
||||
Reference in New Issue
Block a user