Repository navigation
fix(chat): return the jump arrow to the message the reader left, not the chat bottom - #233
Conversation
ca94eb9 to
d6dfaa8
Compare
iebb
left a comment
There was a problem hiding this comment.
Merged as f42118b with cancellation repair abf9084. Review reproduced a pending origin return overriding a newer reply jump and jumping to the newest messages. The follow-up keeps restoration, its post-layout corrections and its fallback within the original navigation intent. Added the failing-first reply-cancellation case, a second-arrow/latest case, and a real negative-offset history fixture assertion. All 25 focused origin/search/reply boundary tests passed; the combined candidate focused run passed 54.
Independent reviewer confirmation: actual implementation and Telegram API Terms classification checked (compliant; no exception-gate expansion). Every selected exact PR head had passing applicable Quality before publication. The complete integrated result was published on master at abf9084: 3,654 unit/widget tests passed, one existing Linux-only test skipped on macOS; full analysis, formatting, all localization/generated assets and registration-anchor checks passed. Guard-state matrix: false 14, invalid 14, enabled 116 passing, plus a separate enabled-feature interaction and 13 independent search/reply checks. Validation used Flutter 3.44.2/Dart 3.12.2 and example credentials only. Native/build/release configuration is unchanged; no signing, release dispatch or physical-device QA was performed. Post-merge remote Quality is tracked separately from these local results.
Change
Tapping a message's replied-to quote jumps to the replied message. The floating arrow at the bottom right then returned to the chat bottom, which is not where the reader came from.
The arrow now returns to the message the reader was standing on before the jump:
max(120 px, 35% of the viewport)away from the drag baseline (a small nudge to read the quoted neighbourhood keeps it); the chat or topic changes; the session is prepared to exit, reopened or restored; the first-unread jump runs; or any explicit return-to-latest runs.The arrow's position, size, key and glyph are unchanged.
_restoreSessionScrollAnchornow delegates to the same measured restore helper the jump return uses, so the two paths share one measurement instead of two.Telegram API Terms classification
allowTelegramTosViolations(I_DONT_FUCKING_CARE_ABOUT_TOS), disabled in official builds, and available only in an explicitly enabled self-build.Reason and affected Telegram behavior:
Scroll-position bookkeeping inside one open conversation; no request, no state persisted to Telegram, no new data flow.
Basic checks (every PR)
~/.cache/dart3122/bin/dart format --output=none --set-exit-if-changed lib/chat/chat_view.dart test/chat_jump_origin_test.dart→Formatted 2 files (0 changed)./tmp/flutter-3.44.2/bin/flutter analyze lib/chat/chat_view.dart test/chat_jump_origin_test.dart→No issues found!.flutter test --no-pub -j 1 test/chat_jump_origin_test.dart→+6: All tests passed!. Neighbours, one invocation each, all pass:desktop_utility_window(+17),system_picture_in_picture_routing(+2),chat_view_exit_controller(+2),message_replies_sheet(+19) — the first three are the source-pinning suites that readchat_view.dart.Commands, results, platform/build/UI evidence, and reasons for inapplicable checks:
test/chat_jump_origin_test.dartdrives the realChatViewagainst a TdClient proxy fixture (history returned newest→oldest; a positivegetChatHistoryoffset throws, as TDLib would):the arrow returns to the message the reader left, not the bottom— after jumping to a quoted parent and tapping the arrow, the origin row sits at its recorded offset (±1.5 px), its neighbours are in place, andpixels < maxScrollExtent − 200proves the viewport is not at the bottom.without a preceding jump the arrow still goes to the bottom— guards the old behavior.a chain of jumps returns to the first origin.a second tap after the origin is consumed goes to the bottom.a long user drag away from the jump target drops the origin.the history fixture keeps TDLib history semantics— the fixture itself honours the request contract.Mutation checks: reverting only
chat_view.dartto master fails the new suite, and disabling the drag release fails case 5.Line counts (
git show --numstat d6dfaa89):Section 1.4 exception checks
Not applicable
Agentic reviewer confirmation
Agentic code reviewer only: record this confirmation in the PR review or check these boxes before approval.