diff --git a/src/main.tsx b/src/main.tsx index 3e9a8247..ed82e991 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -405,6 +405,7 @@ class ScreenWindowView extends React.Component<{sw : ScreenWindow}, {}> { rszObs : any randomId : string; width : mobx.IObservableValue = mobx.observable.box(0); + lastHeight : number = null; scrollToBottom(reason : string) { let elem = document.getElementById(this.getLinesDOMId()); @@ -467,12 +468,24 @@ class ScreenWindowView extends React.Component<{sw : ScreenWindow}, {}> { let entry = entries[0]; let width = entry.target.offsetWidth; this.updateWidth(width); + if (this.lastHeight == null) { + this.lastHeight = entry.target.offsetHeight; + return; + } + if (this.lastHeight != entry.target.offsetHeight) { + this.lastHeight = entry.target.offsetHeight; + this.doConditionalScrollToBottom("resize-height"); + } } handleDomMutation(mutations, mutObs) { + this.doConditionalScrollToBottom("mut"); + } + + doConditionalScrollToBottom(reason : string) { let {sw} = this.props; if (sw && sw.shouldFollow.get()) { - setTimeout(() => this.scrollToBottom("mut"), 0); + setTimeout(() => this.scrollToBottom(reason), 0); } }