Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
fix: replace intrinsic size rail calculation with drawBehind and add text truncation to prevent layout crashes closes #55
Gotcha Contributora0cda19bc857
diff --git a/app/src/main/java/com/gotcha/ui/MessageBubble.kt b/app/src/main/java/com/gotcha/ui/MessageBubble.ktindex 2a2c938..5cf891d 100644--- a/app/src/main/java/com/gotcha/ui/MessageBubble.kt+++ b/app/src/main/java/com/gotcha/ui/MessageBubble.kt@@ -10,19 +10,19 @@ import androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.combinedClickableimport androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.IntrinsicSizeimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacer-import androidx.compose.foundation.layout.fillMaxHeightimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.heightInimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.widthimport androidx.compose.foundation.layout.widthIn+import androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.verticalScrollimport androidx.compose.material.icons.Iconsimport androidx.compose.material.icons.automirrored.rounded.VolumeOffimport androidx.compose.material.icons.automirrored.rounded.VolumeUp@@ -44,6 +44,8 @@ import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip+import androidx.compose.ui.draw.drawBehind+import androidx.compose.ui.geometry.Offsetimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.asImageBitmapimport androidx.compose.ui.layout.ContentScale@@ -370,18 +372,43 @@ private fun ToolLedger(contentColor: Color,collapsed: Boolean) {- Row(modifier = Modifier.height(IntrinsicSize.Min)) {- Box(- modifier = Modifier- .width(2.dp)- .fillMaxHeight()- .clip(RoundedCornerShape(1.dp))- .background(railColor.copy(alpha = 0.7f))- )- Spacer(modifier = Modifier.width(10.dp))- Column {+ // Rail drawn without IntrinsicSize.Min — the previous Row(height=+ // IntrinsicSize.Min) + Box(fillMaxHeight) forced an intrinsic+ // measurement of a Column containing a Text(maxLines=Int.MAX_VALUE)+ // holding 32KB Termux stdout, recursing through+ // LayoutModifierNode.maxIntrinsicHeight and crashing on expand+ // (issue #55 on 1.0.2). drawBehind paints the rail in the Row's+ // own 2.dp inset without querying children's intrinsics.+ val railAlpha = railColor.copy(alpha = 0.7f)+ Row(+ modifier = Modifier.drawBehind {+ val stroke = 2.dp.toPx()+ drawLine(+ color = railAlpha,+ start = Offset(stroke / 2f, 0f),+ end = Offset(stroke / 2f, size.height),+ strokeWidth = stroke+ )+ }+ ) {+ Spacer(modifier = Modifier.width(12.dp))+ Column(+ modifier = if (collapsed) {+ Modifier+ } else {+ Modifier+ .heightIn(max = 400.dp)+ .verticalScroll(rememberScrollState())+ }+ ) {+ val softCap = 8192+ val display = if (!collapsed && text.length > softCap) {+ text.take(softCap) + "\n…truncated ${text.length - softCap} chars — Copy as text for full output"+ } else {+ text+ }Text(- text = text,+ text = display,style = MaterialTheme.typography.bodySmall,fontFamily = GotchaMono,color = contentColor,