Fix term width in view connection detail modal (#274)

* fix term width

* add horizontal scroll to terminal when it overflows

* revert width of modal
This commit is contained in:
Red J Adaya 2024-02-11 06:18:50 +08:00 committed by GitHub
parent d319e72609
commit 2a4d85430a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 15 deletions

View File

@ -54,6 +54,8 @@
}
.remote-detail {
width: 100%;
.settings-field {
display: flex;
flex-direction: row;
@ -91,8 +93,9 @@
}
.terminal-wrapper {
width: 100%;
margin-top: 5px;
overflow-x: auto;
overflow-y: hidden;
.terminal-connectelem {
height: 163px !important; // Needed to override plugin height
@ -111,7 +114,6 @@
.xterm-screen {
padding: 10px;
width: 541px !important; // Needed to override plugin width
}
}
}

View File

@ -12,12 +12,10 @@ import * as T from "../../../types/types";
import { Modal, Tooltip, Button, Status } from "../elements";
import * as util from "../../../util/util";
import * as textmeasure from "../../../util/textmeasure";
import * as appconst from "../../appconst";
import "./viewremoteconndetail.less";
const RemotePtyRows = 9;
const RemotePtyCols = 80;
@mobxReact.observer
class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
termRef: React.RefObject<any> = React.createRef();
@ -293,7 +291,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
let model = this.model;
let isTermFocused = this.model.remoteTermWrapFocus.get();
let termFontSize = GlobalModel.termFontSize.get();
let termWidth = textmeasure.termWidthFromCols(RemotePtyCols, termFontSize);
let termWidth = textmeasure.termWidthFromCols(appconst.RemotePtyCols, termFontSize);
let remoteAliasText = util.isBlank(remote.remotealias) ? "(none)" : remote.remotealias;
let selectedRemoteStatus = this.getSelectedRemote().status;
@ -371,7 +369,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
ref={this.termRef}
data-remoteid={remote.remoteid}
style={{
height: textmeasure.termHeightFromRows(RemotePtyRows, termFontSize),
height: textmeasure.termHeightFromRows(appconst.RemotePtyRows, termFontSize),
width: termWidth,
}}
></div>

View File

@ -12,9 +12,6 @@ import { GlobalCommandRunner } from "./global";
import { Model } from "./model";
import { getTermPtyData } from "../util/modelutil";
const RemotePtyRows = 8; // also in main.tsx
const RemotePtyCols = 80;
class RemotesModel {
globalModel: Model;
selectedRemoteId: OV<string> = mobx.observable.box(null, {
@ -180,14 +177,14 @@ class RemotesModel {
return;
}
let termOpts = {
rows: RemotePtyRows,
cols: RemotePtyCols,
rows: appconst.RemotePtyRows,
cols: appconst.RemotePtyCols,
flexrows: false,
maxptysize: 64 * 1024,
};
let termWrap = new TermWrap(elem, {
termContext: { remoteId: remoteId },
usedRows: RemotePtyRows,
usedRows: appconst.RemotePtyRows,
termOpts: termOpts,
winSize: null,
keyHandler: (e, termWrap) => {

View File

@ -3,10 +3,10 @@
.terminal-wrapper {
.xterm-viewport {
overflow-y: hidden;
overflow: hidden;
}
&:hover .xterm-viewport,
&:focus-within .xterm-viewport {
overflow-y: auto;
overflow: auto;
}
}