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.
This commit is contained in:
1 parent
4e9f1d028a
commit
487fd1c83c
1 file changed
+26
-2
@@ -2868,6 +2868,9 @@ private fun ToolCard(
|
|||||||
else -> IrisColors.statusRed
|
else -> IrisColors.statusRed
|
||||||
}
|
}
|
||||||
val preview = tool.preview ?: tool.note
|
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(
|
Column(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
@@ -2892,11 +2895,31 @@ private fun ToolCard(
|
|||||||
fontSize = 13.sp,
|
fontSize = 13.sp,
|
||||||
fontWeight = FontWeight.Medium,
|
fontWeight = FontWeight.Medium,
|
||||||
color = IrisColors.textBright,
|
color = IrisColors.textBright,
|
||||||
|
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 =
|
||||||
Modifier
|
Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.clickable { expanded = !expanded },
|
.clickable { expanded = !expanded },
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
}
|
||||||
if (tool.duration != null) {
|
if (tool.duration != null) {
|
||||||
Text(
|
Text(
|
||||||
"${String.format("%.1f", tool.duration)}s",
|
"${String.format("%.1f", tool.duration)}s",
|
||||||
@@ -2905,8 +2928,9 @@ private fun ToolCard(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// One-liner preview (Truncated default / Everything).
|
// One-liner preview (Truncated default / Everything); hidden when it
|
||||||
if (preview != null && detail != ToolDetail.NOTHING) {
|
// is already inlined into the title row above.
|
||||||
|
if (preview != null && detail != ToolDetail.NOTHING && !inlinePreview) {
|
||||||
Text(
|
Text(
|
||||||
preview,
|
preview,
|
||||||
fontSize = 12.sp,
|
fontSize = 12.sp,
|
||||||
|
|||||||
Reference in new issue
Block a user