allow terminal font sizes up to 24px

This commit is contained in:
sawka 2023-11-16 22:49:59 -08:00
parent 514156b07f
commit ad0f11c097
3 changed files with 21 additions and 10 deletions

View File

@ -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<boolean> = mobx.observable.box(false, { name: "ScreenSettings-shareCopied" });
errorMessage: OV<string> = mobx.observable.box(null, { name: "ScreenSettings-errorMessage" });
@ -241,7 +241,11 @@ class ScreenSettingsModal extends React.Component<{ sessionId: string; screenId:
<div className="settings-field">
<div className="settings-label">Connection</div>
<div className="settings-input">
<ConnectionDropdown curRemote={curRemote} onSelectRemote={this.selectRemote} allowNewConn={false}/>
<ConnectionDropdown
curRemote={curRemote}
onSelectRemote={this.selectRemote}
allowNewConn={false}
/>
</div>
</div>
<div className="settings-field">
@ -269,8 +273,7 @@ class ScreenSettingsModal extends React.Component<{ sessionId: string; screenId:
<div className="settings-label">
<div>Archived</div>
<InfoMessage width={400}>
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.
</InfoMessage>
</div>
<div className="settings-input">
@ -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 (

View File

@ -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 };

View File

@ -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