fix(app): close slash picker after inserting a command (#9755)

Publish the resolved replacement selection to the composer. iOS does not emit a native selection event for this edit, leaving autocomplete at the slash until the next keystroke.
This commit is contained in:
Mohamed Boudra
2026-11-15 20:34:17 +07:00
committed by GitHub
parent ef146bc62d
commit c4ff5599c7
2 changed files with 23 additions and 3 deletions
@@ -0,0 +1,13 @@
context platform=ios timeout=60000 retries=0
# Start in an empty, connected composer with the Claude provider selected.
# COMMAND_ROW must name an inserting command, not an immediate client action.
env COMMAND_ROW="/advisor, Let Claude consult a stronger model at key moments"
env COMMAND_TEXT="/advisor "
open sh.paseo.debug
wait "editable=true" 60000
fill "editable=true" "/"
wait "label=\"${COMMAND_ROW}\"" 15000
press "label=\"${COMMAND_ROW}\""
# Do not type or move the caret: replacement itself must close autocomplete.
wait absent "label=\"${COMMAND_ROW}\"" 3000
wait "editable=true value=\"${COMMAND_TEXT}\"" 3000
+10 -3
View File
@@ -204,7 +204,7 @@ export interface MessageInputProps {
onSubmitLoadingPress?: () => void;
/** Intercept key press events before default handling. Return true to prevent default. */
onKeyPress?: (event: ComposerKeyPressEvent) => boolean;
/** Reports cursor selection updates from the underlying input. */
/** Reports selection updates from user input and programmatic replacements. */
onSelectionChange?: (selection: { start: number; end: number }) => void;
onFocusChange?: (focused: boolean) => void;
onHeightChange?: (height: number) => void;
@@ -1468,11 +1468,18 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
if (nextText === "") {
textInputRef.current?.reset();
} else {
textInputRef.current?.replaceText(nextText, selection);
textInputRef.current?.replaceText(nextText, selectionRef.current);
}
onChangeText(nextText);
// iOS does not emit a selection event for a programmatic text replacement.
onSelectionChangeCallback?.(selectionRef.current);
},
[onChangeText, updateComposerHeightForText, updateLiveTextPresence],
[
onChangeText,
onSelectionChangeCallback,
updateComposerHeightForText,
updateLiveTextPresence,
],
);
useLayoutEffect(