force update usedRows when terminal is resized

This commit is contained in:
sawka
2022-09-06 00:14:48 -07:00
parent f4ec8f85fa
commit 8801ab147b
3 changed files with 23 additions and 9 deletions
+8 -2
View File
@@ -1064,10 +1064,16 @@ class ScreenWindowView extends React.Component<{sw : ScreenWindow}, {}> {
cmdNum++;
}
}
let isActive = sw.isActive();
return (
<div className="window-view" style={this.getWindowViewStyle()} id={this.getWindowViewDOMId()}>
<div key="window-tag" className="window-tag">
<span>{sw.name.get()}{sw.shouldFollow.get() ? "*" : ""}</span>
<div key="window-tag" className={cn("window-tag", {"is-active": isActive})}>
<span>
{sw.name.get()}
<If condition={sw.shouldFollow.get()}>
&nbsp;<i className="fa fa-caret-down"/>
</If>
</span>
</div>
<div key="lines" className="lines" onScroll={this.scrollHandler} id={this.getLinesDOMId()} style={linesStyle}>
<div className="lines-spacer"></div>
+6 -2
View File
@@ -67,12 +67,16 @@ html, body, #main {
position: absolute;
top: 0;
right: 0;
background-color: rgba(78, 154, 6, 0.5);
color: white;
background-color: rgba(78, 154, 6, 0.65);
color: black;
padding: 2px 4px 2px 4px;
border-bottom-left-radius: 5px;
z-index: 10;
font-size: 12px;
&.is-active {
color: white;
}
}
.window-empty {
+9 -5
View File
@@ -136,10 +136,13 @@ class TermWrap {
return usedRows;
}
updateUsedRows() {
updateUsedRows(forceFull : boolean) {
if (this.terminal == null) {
return;
}
if (forceFull) {
this.atRowMax = false;
}
if (this.atRowMax) {
return;
}
@@ -147,11 +150,11 @@ class TermWrap {
if (tur >= this.terminal.rows) {
this.atRowMax = true;
}
if (tur <= this.usedRows.get()) {
return;
}
mobx.action(() => {
let oldUsedRows = this.usedRows.get();
if (!forceFull && tur <= oldUsedRows) {
return;
}
this.usedRows.set(tur);
GlobalModel.setTUR(this.sessionId, this.cmdId, this.termSize, tur);
if (this.connectedElem) {
@@ -184,6 +187,7 @@ class TermWrap {
}
this.termSize = newSize;
this.terminal.resize(newSize.cols, newSize.rows);
this.updateUsedRows(true);
}
reloadTerminal(delayMs : number) {
@@ -240,7 +244,7 @@ class TermWrap {
}
this.ptyPos += data.length;
this.terminal.write(data, () => {
this.updateUsedRows();
this.updateUsedRows(false);
});
}
}