[morethanwords/tweb/master](https://github.com/morethanwords/tweb/tree/master) • [5db7cfb](https://github.com/morethanwords/tweb/commit/5db7cfb6f95ef82299f67db2d669cb9a4d971a69) • _3 files, +75/-11_
Center a jump on the highlighted text when the message does not fit the screen

A bubble taller than the screen cannot be centered, so fastSmoothScroll aligns
its start instead - and the search result or the quote we jumped to stays
wherever it is, several screens below: highlighted, painted and out of sight.

The scroll knows about the highlight now. When the bubble does not fit and its
start does not bring the text into view either, the text itself is centered:
findTextRect measures the match (the very ranges the highlight paints, without
painting anything), and scrollToBubble hands its offset inside the bubble to
getElementPosition and its height to fastSmoothScroll's new getElementSize -
"the part of the element that has to end up in the middle". The date group
fallback is dropped for such a scroll, it would land on the group instead of
the text, so a match taller than the screen aligns at its start, the way
tdesktop's AdjustScrollForRange does it.

Nothing moves differently when the message fits the screen, when the match is
already within its first screenful, or when there is no match to find.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

[morethanwords/tweb/master](https://github.com/morethanwords/tweb/tree/master) • [b21491c](https://github.com/morethanwords/tweb/commit/b21491cfdec248127cfb6a1e6617e26826021ff4) • _300 files, +811/-800_
Build

[#webk](?q=%23webk)