@@ -711,7 +711,7 @@ private fun ThreadVoiceMode(
711711 val coroutineScope = rememberCoroutineScope()
712712 val visibleConversation = conversation.takeLast(VISIBLE_REALTIME_ENTRY_COUNT )
713713 val contentRevision = wearThreadContentRevision(visibleConversation, thinking)
714- val latestItemIndex = visibleConversation.size + ( if ( thinking) 1 else 0 ) - 1
714+ val latestAnchorIndex = wearThreadLatestAnchorIndex( visibleConversation.size, thinking)
715715 var followState by remember { mutableStateOf(WearThreadFollowState ()) }
716716
717717 LaunchedEffect (listState) {
@@ -737,8 +737,8 @@ private fun ThreadVoiceMode(
737737 realtimeActive = realtimeActive,
738738 )
739739 followState = update.state
740- if (update.scrollToLatest && latestItemIndex >= 0 ) {
741- listState.requestScrollToItem(latestItemIndex )
740+ if (update.scrollToLatest && latestAnchorIndex >= 0 ) {
741+ listState.requestScrollToItem(latestAnchorIndex )
742742 }
743743 }
744744
@@ -775,6 +775,10 @@ private fun ThreadVoiceMode(
775775 WearThreadThinking ()
776776 }
777777 }
778+ // Follow a trailing anchor: centering a growing bubble can hide its newly streamed tail.
779+ item(key = " realtime-thread-end" ) {
780+ Spacer (modifier = Modifier .height(1 .dp))
781+ }
778782 }
779783 }
780784 if (followState.hasNewContent) {
@@ -787,9 +791,9 @@ private fun ThreadVoiceMode(
787791 .border(1 .dp, colors.voiceAccent, RoundedCornerShape (14 .dp))
788792 .clickable(role = Role .Button ) {
789793 followState = wearThreadFollowLatest(followState)
790- if (latestItemIndex >= 0 ) {
794+ if (latestAnchorIndex >= 0 ) {
791795 coroutineScope.launch {
792- listState.animateScrollToItem(latestItemIndex )
796+ listState.animateScrollToItem(latestAnchorIndex )
793797 }
794798 }
795799 }.padding(horizontal = 10 .dp, vertical = 5 .dp),
@@ -923,6 +927,11 @@ internal fun wearThreadContentRevision(
923927 )
924928}
925929
930+ internal fun wearThreadLatestAnchorIndex (
931+ entryCount : Int ,
932+ thinking : Boolean ,
933+ ): Int = if (entryCount == 0 && ! thinking) - 1 else entryCount + if (thinking) 1 else 0
934+
926935internal fun nextWearThreadFollowForContent (
927936 state : WearThreadFollowState ,
928937 contentRevision : WearThreadContentRevision ,
0 commit comments