@@ -26,7 +26,6 @@ import androidx.compose.foundation.layout.Row
26import androidx.compose.foundation.layout.Spacer
26import androidx.compose.foundation.layout.Spacer
27import androidx.compose.foundation.layout.fillMaxSize
27import androidx.compose.foundation.layout.fillMaxSize
28import androidx.compose.foundation.layout.fillMaxWidth
28import androidx.compose.foundation.layout.fillMaxWidth
29−import androidx.compose.foundation.layout.heightIn
30import androidx.compose.foundation.layout.PaddingValues
29import androidx.compose.foundation.layout.PaddingValues
31import androidx.compose.foundation.layout.WindowInsets
30import androidx.compose.foundation.layout.WindowInsets
32import androidx.compose.foundation.layout.ime
31import androidx.compose.foundation.layout.ime
@@ -46,7 +45,6 @@ import androidx.compose.material.icons.automirrored.filled.Send
46import androidx.compose.material.icons.filled.ChatBubbleOutline
45import androidx.compose.material.icons.filled.ChatBubbleOutline
47import androidx.compose.material.icons.filled.Close
46import androidx.compose.material.icons.filled.Close
48import androidx.compose.material.icons.filled.KeyboardArrowDown
47import androidx.compose.material.icons.filled.KeyboardArrowDown
49−import androidx.compose.material.icons.filled.KeyboardArrowUp
50import androidx.compose.material.icons.filled.Stop
48import androidx.compose.material.icons.filled.Stop
51import androidx.compose.material3.CircularProgressIndicator
49import androidx.compose.material3.CircularProgressIndicator
52import androidx.compose.material3.ExperimentalMaterial3Api
50import androidx.compose.material3.ExperimentalMaterial3Api
@@ -113,12 +111,6 @@ fun ChatScreen(state: UiState, dispatch: (Event) -> Unit) {
116− // Offer a jump-to-top shortcut once the conversation is long and the user has
117− // scrolled a few messages down — saves flick-scrolling back through history.
118− val showScrollTop by remember {
119− derivedStateOf { state.messages.size > 10 && listState.firstVisibleItemIndex > 3 }
122 // Track how many messages the user has "seen" (i.e. was at the bottom for). While
114 // Track how many messages the user has "seen" (i.e. was at the bottom for). While
123 // they're scrolled up, any messages beyond that count are unseen — flag the FAB.
115 // they're scrolled up, any messages beyond that count are unseen — flag the FAB.
124 var lastSeenCount by remember { mutableStateOf(0) }
116 var lastSeenCount by remember { mutableStateOf(0) }
@@ -269,14 +261,6 @@ fun ChatScreen(state: UiState, dispatch: (Event) -> Unit) {
273− visible = showScrollTop,
275− coroutineScope.launch {
276− listState.animateScrollToItem(0)
@@ -316,30 +300,6 @@ private fun BoxScope.ScrollToBottomButton(visible: Boolean, showBadge: Boolean,
319−// Mirror of ScrollToBottomButton, pinned to the top-start corner. Same BoxScope
320−// extension trick so the top-level AnimatedVisibility overload resolves cleanly.
322−private fun BoxScope.ScrollToTopButton(visible: Boolean, onClick: () -> Unit) {
325− modifier = Modifier.align(Alignment.TopStart),
326− enter = scaleIn() + fadeIn(),
327− exit = scaleOut() + fadeOut(),
329− Box(Modifier.padding(16.dp)) {
330− FloatingActionButton(
332− modifier = Modifier.size(44.dp),
335− Icons.Filled.KeyboardArrowUp,
336− contentDescription = "Scroll to top",
343private fun copyToClipboard(context: Context, text: String) {
303private fun copyToClipboard(context: Context, text: String) {
344 val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
304 val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
345 clipboard.setPrimaryClip(ClipData.newPlainText("session", text))
305 clipboard.setPrimaryClip(ClipData.newPlainText("session", text))
@@ -510,7 +470,7 @@ private fun ChatInputBar(
510 OutlinedTextField(
470 OutlinedTextField(
511 value = draft,
471 value = draft,
512 onValueChange = onDraftChange,
472 onValueChange = onDraftChange,
513− modifier = Modifier.weight(1f).heightIn(min = 48.dp),
473+ modifier = Modifier.weight(1f),
514 enabled = !loading,
474 enabled = !loading,
515 placeholder = { Text("Message opencode…") },
475 placeholder = { Text("Message opencode…") },
516 maxLines = 5,
476 maxLines = 5,