File tree Expand file tree Collapse file tree
ICSharpCode.AvalonEdit/Rendering Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -944,7 +944,13 @@ protected override Size MeasureOverride(Size availableSize)
944944 TextEditorOptions options = this . Options ;
945945 if ( options . AllowScrollBelowDocument ) {
946946 if ( ! double . IsInfinity ( scrollViewport . Height ) ) {
947- heightTreeHeight = Math . Max ( heightTreeHeight , Math . Min ( heightTreeHeight - 50 , scrollOffset . Y ) + scrollViewport . Height ) ;
947+ // HACK: we need to keep at least Caret.MinimumDistanceToViewBorder visible so that we don't scroll back up when the user types after
948+ // scrolling to the very bottom.
949+ double minVisibleDocumentHeight = Math . Max ( DefaultLineHeight , Editing . Caret . MinimumDistanceToViewBorder ) ;
950+ // scrollViewportBottom: bottom of scroll view port, but clamped so that at least minVisibleDocumentHeight of the document stays visible.
951+ double scrollViewportBottom = Math . Min ( heightTreeHeight - minVisibleDocumentHeight , scrollOffset . Y ) + scrollViewport . Height ;
952+ // increase the extend height to allow scrolling below the document
953+ heightTreeHeight = Math . Max ( heightTreeHeight , scrollViewportBottom ) ;
948954 }
949955 }
950956
You can’t perform that action at this time.
0 commit comments