ScrollToEnd() is inefficient #15
Labels
No labels
Area-Accessibility
Area-Build
Area-CodeCompletion
Area-Document
Area-Documentation
Area-Editing
Area-Folding
Area-Highlighting
Area-i18n
Area-Indentation
Area-NetFx
Area-Rendering
Area-Search
Area-Snippets
dependencies
duplicate
Feedback Needed
help wanted
invalid
Issue-Bug
Issue-Discussion
Issue-Enhancement
Issue-Performance
Issue-Question
on-hold
Resolution-Answered
Resolution-By Design
Resolution-Duplicate
Resolution-Fixed
Resolution-Won't Fix
Up-for-Grabs
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-icsharpcode/AvalonEdit#15
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
AvalonEdit ScrollToEnd() is inefficient -- it sets ScrollOffset to infinity, and relies on the bounds check in arrange() to restore a sane ScrollOffset.
Unfortunately, this has the effect of destroying all cached visual lines. This makes ScrollToEnd() inefficient in log-viewer style applications that frequently append to the document and call ScrollToEnd().
@dgrunwald is there a workaround for log-viewer style applications?
Using
ScrollToVerticalOffsetwas considerably more efficient for me. I had added a method to an inherited class that looked like this:This works mostly well with one exception. When the last wraps (or even possibly any line, need to test) it goes to the visual top of the last line.. but the wrapped portion is still out of view (when I also need that in view). I've tried to account for that by obtaining the line height and adding that to the vertical offset but have been unsuccessful thus far on that front. I wanted to share this regardless in case it helps anyone out.
This appears to work with wrapping:
See if this words. I had it in an inherited class but you get the idea. It seems to perform as well as ScrollToVerticalOffset and also takes it all the way to the bottom (including wraps). I haven't tested it extensively but I'm going to.