Skip to content

fix(chat): a message's editor opens on its message under the window's zoom - #1308

Merged
leookun merged 1 commit into
mainfrom
fix/message-editor-under-zoom
Nov 25, 2026
Merged

leookun merged 1 commit into
mainfrom
fix/message-editor-under-zoom

Conversation

@leookun

@leookun leookun commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #1257 / #1287: a new recording (Windows) still shows the editor's lower lines under the composer.

Cause. The editor is painted over the list at its placeholder's top, computed as placeholder.localToGlobal(0) - layer.localToGlobal(0). UiZoom (Interface Size) scales localToGlobal, while _StickyFollower paints in its own, unscaled units, so the editor landed at zoom × its real distance from the history's top: at 125% a quarter too low (the closer to the bottom, the further off, under the composer); at 80%, too high. The list itself scrolled right, which is why #1287's reveal looked correct in tests (all at 100%). In the recording the closing editor is also drawn below the message it returns to: same cause.

  • _editorTop (open and closing) places it in the layer's own units (getTransformTo(layer)).
  • _scrolledPast measures within the viewport (localToGlobal(ancestor: viewport)).
  • UserMessageBubble.frameIn gives a true on-screen rect; UserMessageEditMorph maps it back with the inverse transform, so the opening frame starts on the bubble under zoom too.

Also. Clicked with a mouse, the editor followed the end again: the history's press handler stops following while the button is held and restores it on release, which runs after the bubble's own pointer-up has opened the editor, undoing #1287's anchored = false (and recording _followedBeforeEdit as false). _startEditing now takes over the press's restore. Tests used touch taps, which skip that path.

Tests (test/chat/message_edit_visibility_test.dart): under zoom 80%/125% the editor opens where its message is; opened with a mouse while following, the list does not follow and follows again once closed. Both failed before the fix (6/6 each). The first test in the file keeps its pending-timer failure on main (unrelated). sticky_message_test, height_motion_test, history_selection_test, chat_history_rebuild_test, user_message_selection_test, user_message_style_test, retry_turn_test pass.

Refs #1257

🤖 Generated with BaoCode

… zoom

The editor is painted over the list, at its placeholder's top: taken as
the difference of the two places on screen, which the window's zoom
(Interface Size) scales while the editor's layer paints in units of its
own. At 125% it was drawn a quarter of its distance from the history's
top too low; near the bottom, its lower lines under the composer, as in
#1257 (at 80%, too high). It is now placed in the layer's own units, and
so is the message it closes back into, and the bubble's frame it opens
from.

And a click with the mouse opened it following the end again: the press
stopped the list following while held, to follow again as it is let go,
after the message had opened its editor (#1287's not following undone).
Opening it now takes that over.

Tests: under zoom (80%, 125%), and opened with a mouse while following;
both failed before. The first test in the file still has its pending
timer on main (unrelated).

Co-Authored-By: BaoCode <noreply@baocode.dev>
@leookun
leookun merged commit 7342646 into main Nov 25, 2026
3 checks passed
@leookun
leookun deleted the fix/message-editor-under-zoom branch November 25, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants