mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix(mention): conditionally remove aftercursor content (#2732)
This commit is contained in:
parent
33ee5d6c34
commit
3df9eac5b7
1 changed files with 6 additions and 1 deletions
|
|
@ -33,7 +33,12 @@ export function insertMention(
|
|||
if (lastAtIndex !== -1) {
|
||||
// If there's an '@' symbol, replace everything after it with the new mention
|
||||
const beforeMention = text.slice(0, lastAtIndex)
|
||||
newValue = beforeMention + "@" + value + " " + afterCursor.replace(/^[^\s]*/, "")
|
||||
// Only replace if afterCursor is all alphanumerical
|
||||
// This is required to handle languages that don't use space as a word separator (chinese, japanese, korean, etc)
|
||||
const afterCursorContent = /^[a-zA-Z0-9\s]*$/.test(afterCursor)
|
||||
? afterCursor.replace(/^[^\s]*/, "")
|
||||
: afterCursor
|
||||
newValue = beforeMention + "@" + value + " " + afterCursorContent
|
||||
mentionIndex = lastAtIndex
|
||||
} else {
|
||||
// If there's no '@' symbol, insert the mention at the cursor position
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue