mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
checkpoint, term height
This commit is contained in:
+4
-3
@@ -11,7 +11,7 @@ import cn from "classnames";
|
||||
import {TermWrap} from "./term";
|
||||
import type {SessionDataType, LineType, CmdDataType, RemoteType, RemoteStateType, RemoteInstanceType, RemotePtrType, HistoryItem, HistoryQueryOpts, RemoteEditType} from "./types";
|
||||
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
||||
import {GlobalModel, GlobalCommandRunner, Session, Cmd, Window, Screen, ScreenWindow, riToRPtr, widthToCols, termWidthFromCols, termHeightFromRows} from "./model";
|
||||
import {GlobalModel, GlobalCommandRunner, Session, Cmd, Window, Screen, ScreenWindow, riToRPtr, widthToCols, termWidthFromCols, termHeightFromRows, termRowsFromHeight} from "./model";
|
||||
import {isModKeyPress} from "./util";
|
||||
|
||||
dayjs.extend(localizedFormat)
|
||||
@@ -567,11 +567,11 @@ class TextAreaInput extends React.Component<{}, {}> {
|
||||
if (e.code == "Tab") {
|
||||
e.preventDefault();
|
||||
if (lastTab) {
|
||||
GlobalModel.submitCommand("compgen", null, [curLine], {"comppos": String(curLine.length), "compshow": "1", "nohist": "1"}, true);
|
||||
GlobalModel.submitCommand("_compgen", null, [curLine], {"comppos": String(curLine.length), "compshow": "1", "nohist": "1"}, true);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
GlobalModel.submitCommand("compgen", null, [curLine], {"comppos": String(curLine.length), "nohist": "1"}, true);
|
||||
GlobalModel.submitCommand("_compgen", null, [curLine], {"comppos": String(curLine.length), "nohist": "1"}, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2297,6 +2297,7 @@ class SessionView extends React.Component<{}, {}> {
|
||||
<div className="session-view" data-sessionid={session.sessionId}>
|
||||
<ScreenView screen={activeScreen}/>
|
||||
<ScreenTabs session={session}/>
|
||||
<div style={{height: 110}}></div>
|
||||
<CmdInput/>
|
||||
</div>
|
||||
);
|
||||
|
||||
+21
-1
@@ -36,6 +36,14 @@ function termHeightFromRows(rows : number) : number {
|
||||
return Math.ceil(DefaultCellHeight*rows);
|
||||
}
|
||||
|
||||
function termRowsFromHeight(height : number) : number {
|
||||
let rows = Math.floor((height - 80)/DefaultCellHeight);
|
||||
if (rows <= 0) {
|
||||
rows = 1;
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
function cmdStatusIsRunning(status : string) : boolean {
|
||||
return status == "running" || status == "detached";
|
||||
}
|
||||
@@ -279,6 +287,7 @@ class ScreenWindow {
|
||||
name : OV<string>;
|
||||
layout : OV<LayoutType>;
|
||||
lastCols : number;
|
||||
lastRows : number;
|
||||
selectedLine : OV<number>;
|
||||
focusType : OV<"input"|"cmd"|"cmd-fg">;
|
||||
anchorLine : number = null;
|
||||
@@ -462,6 +471,16 @@ class ScreenWindow {
|
||||
GlobalCommandRunner.resizeWindow(this.windowId, cols);
|
||||
}
|
||||
|
||||
rowsCallback(rows : number) : void {
|
||||
if (!this.isActive() || rows == 0) {
|
||||
return;
|
||||
}
|
||||
if (rows == this.lastCols) {
|
||||
return;
|
||||
}
|
||||
this.lastRows = rows;
|
||||
}
|
||||
|
||||
getTermWrap(cmdId : string) : TermWrap {
|
||||
return this.terms[cmdId];
|
||||
}
|
||||
@@ -1617,6 +1636,7 @@ class Model {
|
||||
let sw = screen.getActiveSW();
|
||||
if (sw != null) {
|
||||
rtn.termopts.cols = sw.lastCols;
|
||||
rtn.winsize = {rows: sw.lastRows, cols: sw.lastCols};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2316,6 +2336,6 @@ if ((window as any).GlobalModel == null) {
|
||||
GlobalModel = (window as any).GlobalModel;
|
||||
GlobalCommandRunner = (window as any).GlobalCommandRunner;
|
||||
|
||||
export {Model, Session, Window, GlobalModel, GlobalCommandRunner, Cmd, Screen, ScreenWindow, riToRPtr, widthToCols, termWidthFromCols, termHeightFromRows};
|
||||
export {Model, Session, Window, GlobalModel, GlobalCommandRunner, Cmd, Screen, ScreenWindow, riToRPtr, widthToCols, termWidthFromCols, termHeightFromRows, termRowsFromHeight};
|
||||
|
||||
|
||||
|
||||
+14
-7
@@ -56,6 +56,7 @@ html, body, #main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 300px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.screen-view {
|
||||
@@ -495,7 +496,7 @@ html, body, #main {
|
||||
right: 0;
|
||||
background-color: @term-red;
|
||||
color: white;
|
||||
z-index: 10;
|
||||
z-index: 110;
|
||||
padding: 4px;
|
||||
.mono-font(10px);
|
||||
}
|
||||
@@ -526,7 +527,7 @@ html, body, #main {
|
||||
height: calc(100% - 20px);
|
||||
top: 10px;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
z-index: 8;
|
||||
|
||||
&.selected {
|
||||
display: block;
|
||||
@@ -549,6 +550,7 @@ html, body, #main {
|
||||
width: 38px;
|
||||
background-color: #555;
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
@@ -643,6 +645,7 @@ html, body, #main {
|
||||
color: #ddd;
|
||||
margin-left: 8px;
|
||||
margin-top: 4px;
|
||||
white-space: nowrap;
|
||||
.mono-font(14px);
|
||||
}
|
||||
|
||||
@@ -747,15 +750,18 @@ body .xterm .xterm-viewport {
|
||||
|
||||
.cmd-input {
|
||||
border-radius: 0;
|
||||
border-top: 2px solid #ccc;
|
||||
border-top: 4px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-bottom-right-radius: 10px;
|
||||
max-height: max(300px, 40%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
padding: 20px 20px 20px 20px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: 20px 25px 20px 20px;
|
||||
z-index: 100;
|
||||
|
||||
&.has-info {
|
||||
padding-top: 5px;
|
||||
@@ -799,8 +805,9 @@ body .xterm .xterm-viewport {
|
||||
}
|
||||
|
||||
.cmd-input-context {
|
||||
color: #fff;
|
||||
.mono-font();
|
||||
color: #fff;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cmd-input-field {
|
||||
@@ -860,7 +867,7 @@ body .xterm .xterm-viewport {
|
||||
|
||||
.history-title {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
z-index: 102;
|
||||
top: 5px;
|
||||
left: 20px;
|
||||
background-color: black;
|
||||
|
||||
@@ -171,6 +171,7 @@ type UIContextType = {
|
||||
windowid : string,
|
||||
remote : RemotePtrType,
|
||||
termopts : UIContextTermOptsType,
|
||||
winsize : TermWinSize,
|
||||
};
|
||||
|
||||
type FeCmdPacketType = {
|
||||
|
||||
Reference in New Issue
Block a user