diff --git a/src/main.tsx b/src/main.tsx index 67c73c60..208fb00a 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1633,7 +1633,13 @@ class LinesView extends React.Component<{sw : ScreenWindow, width : number, line componentDidMount() : void { let {sw, lines} = this.props; - if (sw.anchorLine == null) { + let linesElem = this.linesRef.current; + let anchorLineObj = sw.getLineByNum(sw.anchorLine); + if (anchorLineObj == null) { + // scroll to bottom + if (linesElem != null) { + linesElem.scrollTop = linesElem.clientHeight; + } this.computeAnchorLine(); } else { @@ -1642,7 +1648,6 @@ class LinesView extends React.Component<{sw : ScreenWindow, width : number, line this.lastSelectedLine = sw.getSelectedLine(); this.lastLinesLength = lines.length; - let linesElem = this.linesRef.current; if (linesElem != null) { this.lastOffsetHeight = linesElem.offsetHeight; this.lastOffsetWidth = linesElem.offsetWidth;