partial resize handling

This commit is contained in:
sawka
2023-01-31 21:25:11 -08:00
parent 381ed04153
commit 65e23f9f48
3 changed files with 36 additions and 11 deletions
+9 -4
View File
@@ -419,6 +419,11 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType, width
GlobalCommandRunner.lineStar(line.lineid, 0);
}
}
@boundMethod
handleResizeButton() {
console.log("resize button");
}
render() {
let {sw, line, width, staticRender, visible} = this.props;
@@ -472,12 +477,12 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType, width
<div key="meta1" className="meta">
<div className="user" style={{display: "none"}}>{line.userid}</div>
<div className="ts">{formattedTime}</div>
<div className="termopts">
({termOpts.rows}x{termOpts.cols})
<If condition={cmd.isRunning() && false}><i onClick={this.doResizeButton} className="resize-button fa fa-arrows-alt"/></If>
</div>
</div>
<div key="meta2" className="meta">
<div className="metapart-mono" style={{display: "none"}}>
{line.cmdid}
({termOpts.rows}x{termOpts.cols})
</div>
{this.renderCmdText(cmd, remote)}
</div>
</div>
+7 -7
View File
@@ -28,7 +28,7 @@ type SWLinePtr = {
};
function widthToCols(width : number) : number {
let cols = Math.trunc((width - 32) / DefaultCellWidth) - 1;
let cols = Math.trunc((width - 50) / DefaultCellWidth) - 1;
cols = boundInt(cols, MinTermCols, MaxTermCols);
return cols;
}
@@ -42,7 +42,7 @@ function termHeightFromRows(rows : number) : number {
}
function termRowsFromHeight(height : number) : number {
let rows = Math.floor((height - 80)/DefaultCellHeight);
let rows = Math.floor((height - 80)/DefaultCellHeight) - 1;
if (rows <= 0) {
rows = 1;
}
@@ -472,15 +472,15 @@ class ScreenWindow {
if (!this.isActive() || cols == 0 || rows == 0) {
return;
}
this.lastRows = rows;
if (cols == this.lastCols) {
if (rows == this.lastRows && cols == this.lastCols) {
return;
}
this.lastRows = rows;
this.lastCols = cols;
for (let cmdid in this.terms) {
this.terms[cmdid].resizeCols(cols);
}
GlobalCommandRunner.resizeWindow(this.windowId, cols);
GlobalCommandRunner.resizeWindow(this.windowId, rows, cols);
}
getTermWrap(cmdId : string) : TermWrap {
@@ -2281,8 +2281,8 @@ class CommandRunner {
GlobalModel.submitCommand("screen", "close", [screen], {"nohist": "1"}, false);
}
resizeWindow(windowId : string, cols : number) {
GlobalModel.submitCommand("sw", "resize", null, {"nohist": "1", "window": windowId, "cols": String(cols)}, false);
resizeWindow(windowId : string, rows : number, cols : number) {
GlobalModel.submitCommand("sw", "resize", null, {"nohist": "1", "window": windowId, "cols": String(cols), "rows": String(rows)}, false);
}
showRemote(remoteid : string) {
+20
View File
@@ -559,6 +559,10 @@ html, body, #main {
background-color: #222;
}
&:hover .meta .termopts {
display: block;
}
.focus-indicator {
position: absolute;
display: none;
@@ -680,6 +684,21 @@ html, body, #main {
margin-top: 5px;
font-size: 12px;
}
.termopts {
margin-left: 10px;
color: #aaa;
margin-top: 7px;
font-size: 12px;
.mono-font(10px);
display: none;
.resize-button {
cursor: pointer;
padding-left: 3px;
padding-right: 3px;
}
}
.metapart-mono {
color: #ddd;
@@ -861,6 +880,7 @@ body .xterm .xterm-viewport {
.mono-font();
padding-bottom: calc(0.5em - 1px);
padding-top: calc(0.5em - 1px);
resize: none;
&:active, &:focus {
border-color: white !important;