From 05af5a8510947d4279c98fe56187f516bb704cda Mon Sep 17 00:00:00 2001 From: sawka Date: Wed, 13 Jul 2022 01:03:17 -0700 Subject: [PATCH] get input working, fix currentrowheight constant --- src/main.tsx | 2 +- src/model.ts | 2 +- src/term.ts | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index eb448a23..ab294439 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -179,7 +179,7 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType}, {}> return
[cmd not found '{line.cmdid}']
; } let termLoaded = this.termLoaded.get(); - let cellHeightPx = 17; + let cellHeightPx = 16; let usedRows = cmd.getUsedRows(sw.screenId, sw.windowId); let totalHeight = cellHeightPx * usedRows; let remote = model.getRemote(cmd.remoteId); diff --git a/src/model.ts b/src/model.ts index 1c50caa1..a85f5978 100644 --- a/src/model.ts +++ b/src/model.ts @@ -55,7 +55,7 @@ class Cmd { console.log("term-wrap already exists for", screenId, windowId); return; } - termWrap = new TermWrap(elem, this.sessionId, this.cmdId, 0, this.getTermOpts(), this.handleKey); + termWrap = new TermWrap(elem, this.sessionId, this.cmdId, 0, this.getTermOpts(), this.handleKey.bind(this)); this.instances[screenId + "/" + windowId] = termWrap; return; } diff --git a/src/term.ts b/src/term.ts index 3ce58ca9..db8b3ec1 100644 --- a/src/term.ts +++ b/src/term.ts @@ -52,7 +52,7 @@ class TermWrap { this.atRowMax = true; this.usedRows = mobx.observable.box(termOpts.rows); } - this.terminal = new Terminal({rows: termOpts.rows, cols: termOpts.cols, theme: {foreground: "#d3d7cf"}}); + this.terminal = new Terminal({rows: termOpts.rows, cols: termOpts.cols, fontSize: 14, theme: {foreground: "#d3d7cf"}}); this.terminal.open(elem); if (keyHandler != null) { this.terminal.onKey(keyHandler); @@ -66,6 +66,10 @@ class TermWrap { this.reloadTerminal(0); } + getFontHeight() : number { + return this.terminal._core.viewport._currentRowHeight; + } + dispose() { if (this.terminal != null) { this.terminal.dispose();