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, 17:15 UTC
fix(mobile): Android terminal resizes the engine when only the cell size changes (#36023)
Julius Marminge committed
Nov 12, 2026 at 22:24 UTC
7179113617a540a0ab751b1f8000cd87b803817e
1 file changed
+10
-10
apps/mobile/modules/t3-terminal/android/src/main/java/expo/modules/t3terminal/T3TerminalView.kt
+10
-10
@@ -67,6 +67,7 @@ class T3TerminalView(context: Context, appContext: AppContext) : ExpoView(contex
67
private var streamedOutput: TerminalOutputBuffer? = null
68
private var cols = 0
69
private var rows = 0
70
+ private var cellSize = 0 to 0
71
private var measuredCols = 0
72
private var measuredRows = 0
73
private var clearingInput = false
@@ -356,25 +357,24 @@ class T3TerminalView(context: Context, appContext: AppContext) : ExpoView(contex
357
applyGrid()
358
}
359
360
+ @Suppress("ComplexCondition")
361
private fun applyGrid() {
362
if (measuredCols <= 0 || measuredRows <= 0 || isCleanedUp) return
363
val shared = sharedGrid.takeIf { it.size == 2 && it[0] > 0 && it[1] > 0 }
364
val nextCols = shared?.get(0)?.coerceAtMost(measuredCols) ?: measuredCols
365
val nextRows = shared?.get(1)?.coerceAtMost(measuredRows) ?: measuredRows
364
- if (nextCols == cols && nextRows == rows && terminalHandle != 0L) return
366
+ val nextCellSize = terminalCanvas.cellWidthPx.toInt() to terminalCanvas.cellHeightPx.toInt()
367
+ if (nextCols == cols && nextRows == rows && nextCellSize == cellSize && terminalHandle != 0L) {
368
+ return
369
+ }
370
cols = nextCols
371
rows = nextRows
372
+ cellSize = nextCellSize
373
val response = if (terminalHandle == 0L) {
374
createTerminal()
375
ByteArray(0)
376
} else {
371
- GhosttyBridge.nativeResize(
372
- terminalHandle,
373
- cols,
374
- rows,
375
- terminalCanvas.cellWidthPx.toInt(),
376
- terminalCanvas.cellHeightPx.toInt(),
377
- )
377
+ GhosttyBridge.nativeResize(terminalHandle, cols, rows, cellSize.first, cellSize.second)
378
}
379
emitResponse(response)
380
if (!hasPendingBuffer) feedPendingBuffer()
@@ -387,8 +387,8 @@ class T3TerminalView(context: Context, appContext: AppContext) : ExpoView(contex
387
terminalHandle = GhosttyBridge.nativeCreate(
388
cols,
389
rows,
390
- terminalCanvas.cellWidthPx.toInt(),
391
- terminalCanvas.cellHeightPx.toInt(),
390
+ cellSize.first,
391
+ cellSize.second,
392
foregroundColorValue,
393
backgroundColorValue,
394
cursorColorValue,