diff --git a/src/main.tsx b/src/main.tsx index 680980e80..281b3e973 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -126,6 +126,8 @@ class LineCmd extends React.Component<{line : LineType, session : Session, chang termWrap.resizeToContent(); let termSize = termWrap.getSize(); let formattedTime = getLineDateStr(line.ts); + let cellHeightPx = 17; + let totalHeight = cellHeightPx * termWrap.usedRows; return (
= 5}, {"running": running})}> @@ -146,8 +148,8 @@ class LineCmd extends React.Component<{line : LineType, session : Session, chang [mike@local ~] {this.singleLineCmdText(line.cmdtext)}
-
-
+
+
diff --git a/src/session.ts b/src/session.ts index 45e5cfdfe..5dd499e55 100644 --- a/src/session.ts +++ b/src/session.ts @@ -56,6 +56,8 @@ class Session { termMap : Record = {}; termMapById : Record = {}; history : HistoryItem[] = []; + curRemote : string; + curDir : string; constructor() { } diff --git a/src/term.ts b/src/term.ts index 121073bda..5fffacd59 100644 --- a/src/term.ts +++ b/src/term.ts @@ -30,16 +30,17 @@ class TermWrap { isFocused : mobx.IObservableValue = mobx.observable.box(false, {name: "focus"}); flexRows : boolean = true; maxRows : number = 25; - cols : number = 80; atRowMax : boolean = false; initialized : boolean = false; changeSizeCallback : (TermWrap) => void = null; + usedRows : number = null; constructor(sessionId : string, cmdId : string) { this.termId = uuidv4(); this.sessionId = sessionId; this.cmdId = cmdId; - this.terminal = new Terminal({rows: 2, cols: 80, theme: {foreground: "#d3d7cf"}}); + this.terminal = new Terminal({rows: 25, cols: 80, theme: {foreground: "#d3d7cf"}}); + this.usedRows = mobx.observable.box(2, {name: "usedRows"}); } destroy() { @@ -90,30 +91,31 @@ class TermWrap { return; } let term = this.terminal; - let termNumLines = term._core.buffer.lines.length; - let termYPos = term._core.buffer.y; - let newRows : number = term.rows; - if (term.rows < this.maxRows && termNumLines > term.rows) { - newRows = Math.min(this.maxRows, termNumLines); - } else if (term.rows < this.maxRows && termYPos >= term.rows) { - newRows = Math.min(this.maxRows, termYPos+1); - } - if (newRows == this.maxRows) { + let termBuf = term._core.buffer; + let termNumLines = termBuf.lines.length; + let termYPos = termBuf.y; + let usedRows = 2; + if (termNumLines > term.rows) { + this.usedRows = term.rows; this.atRowMax = true; - } - if (newRows == term.rows) { return; } - term.resize(this.cols, newRows); - if (this.changeSizeCallback) { - setTimeout(() => this.changeSizeCallback(this), 0); + if (termYPos >= usedRows) { + usedRows = termYPos + 1; } + for (let i=usedRows; i incRenderVersion(), 10);