Repository navigation
Keep the remote cursor in place while another user types - #75
Merged
Merged
Conversation
KodeEditor hands the overlay the layout of the previous text for one frame after the text changed, while the sync session has already resolved the peers against the new text. A cursor at the end of a line, where people usually type, then landed on the start of the next line for that frame, so the name label jumped with every remote change. The overlay now draws the peers that belong to the laid out text and switches to the new peers once the new text is laid out. A Robolectric Compose test steps through the frames while another user types at the end of a line. It failed before this change and passes now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The name label of another user flickered on every change while that user typed (seen on build-474 while someone typed in the web client).
Cause. KodeEditor stores the
TextLayoutResultfromonTextLayoutin state and passes it to the overlay. After a remote change, the overlay composes once with the new peer positions but the old layout, because the new layout only arrives during measure.DocumentSyncSessionresolves the peers against the new text in the same main-thread message as the text update. For a cursor at the end of a line, where people usually type, offset p+1 in the old layout is the start of the next line, so the label jumped there for one frame and back. The presence and cursor resolution was not the cause: the web client sends cursors on the character after the caret, and those already exist when the presence arrives.Fix.
RemotePeersOverlaynow gets the current editor text. ThroughLaidOutPeers, it keeps drawing the peers that belong to the laid-out text until the new text is laid out. KodeEditor needs no change, because its overlay docs already require indices within the laid-out text.Test.
RemotePeersOverlayTestruns Robolectric with native graphics (new test dependencies: robolectric 4.16, compose ui-test-junit4, ui-test-manifest). It rendersCodeEditorLayoutand steps frame by frame while a peer types "!!!" at the end of a line. It records the label position after each frame.(64,16) (64,16) (24,0) (72,16) .... The label goes to the start of the next line once per change.🤖 Generated with Claude Code