@devries-cameron20 / t3code Mirror · read-only / commits / e895a56c4b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 18:30 UTC

fix(mobile): select part of a source file's text on iOS (#33218)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Bin Jamshid committed Nov 13, 2026 at 03:09 UTC e895a56c4b3a22fdcd78c9df48e2af34ddea4ab6
1 file changed +18 -1
apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx
+18 -1
@@ -226,7 +226,7 @@ function FileSourceSurface(props: ComponentProps<typeof SourceFileSurface>) {
226 <SourceFileSurface
227 {...props}
228 initialLine={selection?.line ?? props.initialLine}
229 - selectable={selection?.active === true}
229 + selectable={props.selectable === true || selection?.active === true}
230 onLongPressLine={
231 Platform.OS === "android" ? (line) => setSelection({ line, active: true }) : undefined
232 }
@@ -250,6 +250,7 @@ function FileContent(props: {
250 readonly threadId: ThreadId | null;
251 readonly initialLine: number | null;
252 readonly truncated: boolean;
253 + readonly selectable: boolean;
254 readonly onRefresh?: () => Promise<void> | void;
255 }) {
256 // Reopening a mutable host file must not reuse a poster from an earlier visit.
@@ -351,6 +352,7 @@ function FileContent(props: {
352 path={props.relativePath}
353 initialLine={props.initialLine}
354 headerInsetTop={props.truncated ? 0 : undefined}
355 + selectable={props.selectable}
356 onRefresh={props.onRefresh}
357 />
358 )}
@@ -650,6 +652,7 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
652 readonly path: string;
653 readonly mode: FileViewMode;
654 } | null>(null);
655 + const [textSelectionPath, setTextSelectionPath] = useState<string | null>(null);
656 const [previewRevision, setPreviewRevision] = useState(0);
657 const previewKey = JSON.stringify([environmentId, cwd, relativePath, previewRevision]);
658 const [fullScreenPreview, setFullScreenPreview] = useState<FilePreviewSource | null>(null);
@@ -749,6 +752,10 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
752 : null,
753 );
754 const fileData = fileQuery.data as ProjectReadFileResult | null;
755 + // iOS only: Android lays out a whole-file selectable TextView on the UI thread, which stalls.
756 + const canSelectText =
757 + Platform.OS === "ios" && resolvedActiveMode === "source" && fileData?.contents != null;
758 + const selectingText = canSelectText && textSelectionPath === relativePath;
759
760 const handleSelectFile = (path: string) => {
761 const targetPath =
@@ -837,6 +844,15 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
844 onPress: () => setCodeWordBreak(!appearance.codeWordBreak),
845 } as const)
846 : null,
847 + canSelectText
848 + ? ({
849 + id: "select-text",
850 + title: selectingText ? "Done selecting" : "Select text",
851 + icon: "character.cursor.ibeam",
852 + inline: false,
853 + onPress: () => setTextSelectionPath(selectingText ? null : relativePath),
854 + } as const)
855 + : null,
856 ...(mediaSource
857 ? mediaActions.actions
858 .filter(({ id }) => id !== "open-file")
@@ -1046,6 +1062,7 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
1062 relativePath={relativePath}
1063 threadId={threadId}
1064 truncated={fileData?.truncated ?? false}
1065 + selectable={selectingText}
1066 onRefresh={() => fileQuery.refresh()}
1067 />
1068 </ScreenContent>