Fix UI freeze when drag-selecting past the right edge - #609
Open
mgarstenauer wants to merge 1 commit into
Open
Conversation
mgarstenauer
commented
Aug 15, 2026
| public void BringCaretToView() | ||
| { | ||
| BringCaretToView(0); | ||
| BringCaretToView(5.0); |
Contributor
Author
There was a problem hiding this comment.
In most cases only caret.BringCaretToView() is called, which doesn't guarantee that the caret is visible.
For example (tested in AvaloniaEdit.Demo): On a long line when I press End, the caret jumps to the end of the line. The end of the line is visible, but the caret is just slightly out of view.
⇒ I suggest to make BringCaretToView(5.0) the default.
mgarstenauer
force-pushed
the
fix-ui-freeze-when-drag-selecting
branch
from
August 15, 2026 10:29
da53616 to
ffb69fc
Compare
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.
Fixes #606
Problem
The UI will freeze when dragging the selection past the right edge of the text editor. See details in #606.
Cause
The expected behavior is that the scrolling stops when the end of the scroll bar is reached. However, in this case
Caret.BringIntoView(5.0)is called, which adds an artificial border around the caret. When this border lies outside of the range of the scroll viewer thenTextView.MakeVisiblesets an invalid, out-of-range scroll offset. This triggers anotherScrollOffsetChangedevent with the invalid scroll offset. This causes an endless loop, the drag-selecting/scrolling never stops.Solution
In
TextView.MakeVisibleclamp the scroll offset to the allowed range.