add horizontal scroll to terminal when it overflows

This commit is contained in:
Red Adaya 2024-02-10 10:24:40 +08:00
parent 818bcd5094
commit 97af45d4a0
4 changed files with 13 additions and 16 deletions

View File

@ -1,7 +1,7 @@
@import "../../../app/common/themes/themes.less";
.rconndetail-modal {
width: 631px;
width: 680px;
min-height: 565px;
.wave-modal-content {
@ -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: scroll;
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 = 74;
@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;
}
}