From ad0f11c097fe642c221cbd1bebdedd2f0c371adc Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 16 Nov 2023 22:49:59 -0800 Subject: [PATCH] allow terminal font sizes up to 24px --- src/app/common/modals/settings.tsx | 20 +++++++++++++------- src/model/model.ts | 4 +++- wavesrv/pkg/cmdrunner/cmdrunner.go | 7 +++++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/app/common/modals/settings.tsx b/src/app/common/modals/settings.tsx index b7977e11e..3aa7d9560 100644 --- a/src/app/common/modals/settings.tsx +++ b/src/app/common/modals/settings.tsx @@ -7,7 +7,7 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner, TabColors } from "../../../model/model"; +import { GlobalModel, GlobalCommandRunner, TabColors, MinFontSize, MaxFontSize } from "../../../model/model"; import { Toggle, InlineSettingsTextEdit, SettingsError, InfoMessage } from "../common"; import { LineType, RendererPluginType, ClientDataType, CommandRtnType } from "../../../types/types"; import { ConnectionDropdown } from "../../connections/connections"; @@ -50,7 +50,7 @@ Are you sure you want to stop web-sharing this tab? `.trim(); @mobxReact.observer -class ScreenSettingsModal extends React.Component<{ sessionId: string; screenId: string; }, {}> { +class ScreenSettingsModal extends React.Component<{ sessionId: string; screenId: string }, {}> { shareCopied: OV = mobx.observable.box(false, { name: "ScreenSettings-shareCopied" }); errorMessage: OV = mobx.observable.box(null, { name: "ScreenSettings-errorMessage" }); @@ -211,7 +211,7 @@ class ScreenSettingsModal extends React.Component<{ sessionId: string; screenId: let curRemote = GlobalModel.getRemote(GlobalModel.getActiveScreen().getCurRemoteInstance().remoteid); return (
-
+
{this.shareCopied.get() &&
}
@@ -241,7 +241,11 @@ class ScreenSettingsModal extends React.Component<{ sessionId: string; screenId:
Connection
- +
@@ -269,8 +273,7 @@ class ScreenSettingsModal extends React.Component<{ sessionId: string; screenId:
Archived
- Archive will hide the tab. Commands and output will be retained in - history. + Archive will hide the tab. Commands and output will be retained in history.
@@ -630,7 +633,10 @@ class ClientSettingsModal extends React.Component<{}, {}> { } renderFontSizeDropdown(): any { - let availableFontSizes = [8, 9, 10, 11, 12, 13, 14, 15]; + let availableFontSizes = []; + for (let s = MinFontSize; s <= MaxFontSize; s++) { + availableFontSizes.push(s); + } let fsize: number = 0; let curSize = GlobalModel.termFontSize.get(); return ( diff --git a/src/model/model.ts b/src/model/model.ts index 89b814857..5009d2755 100644 --- a/src/model/model.ts +++ b/src/model/model.ts @@ -91,7 +91,7 @@ const DevServerEndpoint = "http://127.0.0.1:8090"; const DevServerWsEndpoint = "ws://127.0.0.1:8091"; const DefaultTermFontSize = 12; const MinFontSize = 8; -const MaxFontSize = 15; +const MaxFontSize = 24; const InputChunkSize = 500; const RemoteColors = ["red", "green", "yellow", "blue", "magenta", "cyan", "white", "orange"]; const TabColors = ["red", "orange", "yellow", "green", "mint", "cyan", "blue", "violet", "pink", "white"]; @@ -4195,5 +4195,7 @@ export { RemoteColors, getTermPtyData, RemotesModalModel, + MinFontSize, + MaxFontSize, }; export type { LineContainerModel }; diff --git a/wavesrv/pkg/cmdrunner/cmdrunner.go b/wavesrv/pkg/cmdrunner/cmdrunner.go index 960cd2cd9..1a5cf037d 100644 --- a/wavesrv/pkg/cmdrunner/cmdrunner.go +++ b/wavesrv/pkg/cmdrunner/cmdrunner.go @@ -61,6 +61,9 @@ const MaxEvalDepth = 5 const MaxOpenAIAPITokenLen = 100 const MaxOpenAIModelLen = 100 +const TermFontSizeMin = 8 +const TermFontSizeMax = 24 + const TsFormatStr = "2006-01-02 15:04:05" const ( @@ -3554,8 +3557,8 @@ func ClientSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (ss if err != nil { return nil, fmt.Errorf("invalid termfontsize, must be a number between 8-15: %v", err) } - if newFontSize < 8 || newFontSize > 15 { - return nil, fmt.Errorf("invalid termfontsize, must be a number between 8-15") + if newFontSize < TermFontSizeMin || newFontSize > TermFontSizeMax { + return nil, fmt.Errorf("invalid termfontsize, must be a number between %d-%d", TermFontSizeMin, TermFontSizeMax) } feOpts := clientData.FeOpts feOpts.TermFontSize = newFontSize