authorgravatar for chris@xenforo.comChris Deeming <chris@xenforo.com> 2026-08-08 04:31:47+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-08-07 23:31:47-04:00
logdaf8ee0b2f684cda82e8721abe1138b219b1ef12
treec82726e4dde4bb5d31e6d1f5fae039ff47864464
parented886fe1814890da30ae73c77f9e894ddc9bd481
signature Signed by PGP key B5690EEEBB952194

fix(web): inherit terminal size in simple typography (#5628)


4 files changed, 38 insertions(+), 3 deletions(-)

apps/web/src/appearanceFonts.test.ts+11
......@@ -11,6 +11,7 @@ import {
1111 cssFontFamilies,
1212 resolveDefaultFamilyLabel,
1313 resolveTerminalFontPreference,
14 resolveTerminalFontSizePreference,
1415} from "./appearanceFonts";
1516
1617describe("areFontAdvancesMonospace", () => {
......@@ -97,6 +98,16 @@ describe("resolveTerminalFontPreference", () => {
9798 });
9899});
99100
101describe("resolveTerminalFontSizePreference", () => {
102 it("inherits the code font size in simple mode", () => {
103 expect(resolveTerminalFontSizePreference({ advanced: false, code: 15, terminal: 12 })).toBe(15);
104 });
105
106 it("keeps code and terminal font sizes independent in advanced mode", () => {
107 expect(resolveTerminalFontSizePreference({ advanced: true, code: 15, terminal: 12 })).toBe(12);
108 });
109});
110
100111describe("font size clamping", () => {
101112 it("keeps sizes inside the ranges the UI can absorb", () => {
102113 expect(clampInterfaceFontSize(16)).toBe(16);
apps/web/src/appearanceFonts.ts+9
......@@ -41,6 +41,15 @@ export function resolveTerminalFontPreference(input: {
4141 return input.code;
4242}
4343
44export function resolveTerminalFontSizePreference(input: {
45 readonly advanced: boolean;
46 readonly code: number;
47 readonly terminal: number;
48}): number {
49 if (input.advanced) return input.terminal;
50 return input.code;
51}
52
4453function quoteFontFamilyName(name: string): string {
4554 const bare = name.trim();
4655 if (bare.length === 0) return "";
apps/web/src/components/ThreadTerminalDrawer.tsx+12-2
......@@ -66,7 +66,11 @@ import { terminalEnvironment } from "../state/terminal";
6666import { openTerminalLinkInPreview } from "./preview/openTerminalLinkInPreview";
6767import { useAtomCommand } from "../state/use-atom-command";
6868import { preventTerminalCloseShortcut } from "../lib/terminalCloseShortcut";
69import { resolveTerminalFontPreference, TYPOGRAPHY_ADVANCED_STORAGE_KEY } from "../appearanceFonts";
69import {
70 resolveTerminalFontPreference,
71 resolveTerminalFontSizePreference,
72 TYPOGRAPHY_ADVANCED_STORAGE_KEY,
73} from "../appearanceFonts";
7074
7175const MIN_DRAWER_HEIGHT = 180;
7276const MAX_DRAWER_HEIGHT_RATIO = 0.75;
......@@ -341,7 +345,13 @@ export function TerminalViewport({
341345 terminal: settings.fontFamilyTerminal,
342346 }),
343347 );
344 const terminalFontSize = useClientSettings((settings) => settings.fontSizeTerminal);
348 const terminalFontSize = useClientSettings((settings) =>
349 resolveTerminalFontSizePreference({
350 advanced: advancedTypography,
351 code: settings.fontSizeCode,
352 terminal: settings.fontSizeTerminal,
353 }),
354 );
345355 const terminalFontRef = useRef({ family: terminalFontFamily, size: terminalFontSize });
346356 const terminalSession = useAttachedTerminalSession({
347357 environmentId,
apps/web/src/components/settings/SettingsPanels.tsx+6-1
......@@ -100,6 +100,7 @@ import {
100100 isMonospaceFamily,
101101 resolveDefaultFamilyLabel,
102102 resolveTerminalFontPreference,
103 resolveTerminalFontSizePreference,
103104 TYPOGRAPHY_ADVANCED_STORAGE_KEY,
104105} from "../../appearanceFonts";
105106import { CodeFontPreview, PromptFontPreview, TerminalFontPreview } from "./SettingsFontPreviews";
......@@ -1272,7 +1273,11 @@ function SimpleFontRows() {
12721273 code: settings.fontFamilyCode,
12731274 terminal: settings.fontFamilyTerminal,
12741275 })}
1275 size={settings.fontSizeTerminal}
1276 size={resolveTerminalFontSizePreference({
1277 advanced: false,
1278 code: settings.fontSizeCode,
1279 terminal: settings.fontSizeTerminal,
1280 })}
12761281 />
12771282 </>
12781283 }