File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
packages/opencode/src/cli/cmd/tui/component/prompt Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -457,6 +457,30 @@ export function Autocomplete(props: {
457457 hide ( )
458458 return
459459 }
460+ } else {
461+ // Check if autocomplete should reopen (e.g., after backspace deleted a space)
462+ const cursorOffset = props . input ( ) . cursorOffset
463+ if ( cursorOffset > 0 ) {
464+ // Check for "/" at position 0 - reopen slash commands
465+ if ( value . startsWith ( "/" ) && ! value . slice ( 0 , cursorOffset ) . match ( / \s / ) ) {
466+ show ( "/" )
467+ setStore ( "index" , 0 )
468+ return
469+ }
470+ // Check for "@" trigger - find the nearest "@" before cursor with no whitespace between
471+ const textBeforeCursor = value . slice ( 0 , cursorOffset )
472+ const lastAtIndex = textBeforeCursor . lastIndexOf ( "@" )
473+ if ( lastAtIndex !== - 1 ) {
474+ const textBetween = textBeforeCursor . slice ( lastAtIndex )
475+ const charBeforeAt = lastAtIndex === 0 ? undefined : value [ lastAtIndex - 1 ]
476+ const canTrigger = charBeforeAt === undefined || / \s / . test ( charBeforeAt )
477+ if ( canTrigger && ! textBetween . match ( / \s / ) ) {
478+ show ( "@" )
479+ setStore ( "index" , lastAtIndex )
480+ return
481+ }
482+ }
483+ }
460484 }
461485 } ,
462486 onKeyDown ( e : KeyEvent ) {
You can’t perform that action at this time.
0 commit comments