2.5 KiB
Known Issues
Chat search: sub-message scroll precision
Status: Requires live debugging session
Symptoms: When navigating search results (prev/next) in the chat search feature, the view scrolls to the correct message but not to the specific text occurrence within long messages. The highlighted orange match can be off-screen if the message is tall.
What works: Match counting per-occurrence, yellow/orange highlighting, dark mode contrast, keyboard dismiss — all work correctly. The only issue is the scroll target precision within a message.
Investigation so far (2 rounds of fixes attempted):
- BringIntoViewRequester approach (
122419c): Attached aBringIntoViewRequesterto theHighlightedTextSegmentcontaining the focused occurrence. CalledbringIntoView()afteranimateScrollToItem(). Didn't work because theLazyColumntreats eachMessageBubbleas a single item —bringIntoView()degrades toscrollToItem()and can't scroll within an item. - onGloballyPositioned + animateScrollBy approach (
c75a76a): ReplacedBringIntoViewRequesterwith a callback chain. The focusedHighlightedTextSegmentreports its pixel coordinates viaModifier.onGloballyPositioned.MessageListcompares the segment'sboundsInRoot()to the viewport and callsanimateScrollBy()with the delta. Still not working — likely a timing issue whereonGloballyPositionedfires before the initialanimateScrollToItem()completes, or coordinate space mismatches between the segment and the viewport.
Key files:
feature/chat/.../components/MessageList.kt— scroll logic,pendingFineTuneScrollflagfeature/chat/.../components/MarkdownContent.kt—HighlightedTextSegmentwithonGloballyPositionedfeature/chat/.../components/ContentPartRenderer.kt— forwardsonFocusedOccurrencePositioncallbackfeature/chat/.../components/MessageBubble.kt— forwards callback whenisCurrentSearchMatch
What's needed: On-device debugging session with Logcat/Timber to trace:
- Whether
onGloballyPositionedfires at the right time (afteranimateScrollToItemcompletes) - The actual coordinate values from
boundsInRoot()vs viewport bounds - Whether
animateScrollBy()is called with the correct delta - Whether the
pendingFineTuneScrollguard allows or blocks the fine-tune scroll
Workaround: User can manually scroll within the message to find the orange-highlighted occurrence after the search navigates to the correct message.