From 487fd1c83c9f4acdc4eddc79d2d786d7f30eefb6 Mon Sep 17 00:00:00 2001 From: ARIA Date: Sun, 23 Aug 2026 01:01:04 +0200 Subject: [PATCH] One-line tool cards in truncated mode When tool verbosity is 'truncated' (the default) and the card is collapsed, fold the preview into the title row so a tool call takes a single line of vertical space: 'Terminal | ls -lah' with the preview in monospace. Tapping still expands to the full args + output. --- .../kotlin/iris/ui/screens/ChatScreen.kt | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/app/shared/src/commonMain/kotlin/iris/ui/screens/ChatScreen.kt b/app/shared/src/commonMain/kotlin/iris/ui/screens/ChatScreen.kt index 5f6a25a..44034b6 100644 --- a/app/shared/src/commonMain/kotlin/iris/ui/screens/ChatScreen.kt +++ b/app/shared/src/commonMain/kotlin/iris/ui/screens/ChatScreen.kt @@ -2868,6 +2868,9 @@ private fun ToolCard( else -> IrisColors.statusRed } val preview = tool.preview ?: tool.note + // Truncated + collapsed: fold the preview into the title row so the card + // takes a single line of vertical space ("Terminal | ls -lah"). + val inlinePreview = detail == ToolDetail.TRUNCATED && !expanded && preview != null Column( modifier = Modifier @@ -2892,11 +2895,31 @@ private fun ToolCard( fontSize = 13.sp, fontWeight = FontWeight.Medium, color = IrisColors.textBright, - modifier = - Modifier - .weight(1f) - .clickable { expanded = !expanded }, + modifier = Modifier.clickable { expanded = !expanded }, ) + if (inlinePreview) { + Spacer(modifier = Modifier.width(6.dp)) + Text( + "|", + fontSize = 12.sp, + color = IrisColors.textDim, + ) + Spacer(modifier = Modifier.width(6.dp)) + Text( + preview, + fontFamily = FontFamily.Monospace, + fontSize = 12.sp, + color = IrisColors.textMuted, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + modifier = + Modifier + .weight(1f) + .clickable { expanded = !expanded }, + ) + } else { + Spacer(modifier = Modifier.weight(1f)) + } if (tool.duration != null) { Text( "${String.format("%.1f", tool.duration)}s", @@ -2905,8 +2928,9 @@ private fun ToolCard( ) } } - // One-liner preview (Truncated default / Everything). - if (preview != null && detail != ToolDetail.NOTHING) { + // One-liner preview (Truncated default / Everything); hidden when it + // is already inlined into the title row above. + if (preview != null && detail != ToolDetail.NOTHING && !inlinePreview) { Text( preview, fontSize = 12.sp,