| author | |
| committer | |
| log | daf8ee0b2f684cda82e8721abe1138b219b1ef12 |
| tree | c82726e4dde4bb5d31e6d1f5fae039ff47864464 |
| parent | ed886fe1814890da30ae73c77f9e894ddc9bd481 |
| signature | Signed by PGP key B5690EEEBB952194 |
4 files changed, 38 insertions(+), 3 deletions(-)
apps/web/src/appearanceFonts.test.ts+11| ... | @@ -11,6 +11,7 @@ import { | ... | @@ -11,6 +11,7 @@ import { |
| 11 | cssFontFamilies, | 11 | cssFontFamilies, |
| 12 | resolveDefaultFamilyLabel, | 12 | resolveDefaultFamilyLabel, |
| 13 | resolveTerminalFontPreference, | 13 | resolveTerminalFontPreference, |
| 14 | resolveTerminalFontSizePreference, | ||
| 14 | } from "./appearanceFonts"; | 15 | } from "./appearanceFonts"; |
| 15 | 16 | ||
| 16 | describe("areFontAdvancesMonospace", () => { | 17 | describe("areFontAdvancesMonospace", () => { |
| ... | @@ -97,6 +98,16 @@ describe("resolveTerminalFontPreference", () => { | ... | @@ -97,6 +98,16 @@ describe("resolveTerminalFontPreference", () => { |
| 97 | }); | 98 | }); |
| 98 | }); | 99 | }); |
| 99 | 100 | ||
| 101 | describe("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 | |||
| 100 | describe("font size clamping", () => { | 111 | describe("font size clamping", () => { |
| 101 | it("keeps sizes inside the ranges the UI can absorb", () => { | 112 | it("keeps sizes inside the ranges the UI can absorb", () => { |
| 102 | expect(clampInterfaceFontSize(16)).toBe(16); | 113 | expect(clampInterfaceFontSize(16)).toBe(16); |
apps/web/src/appearanceFonts.ts+9| ... | @@ -41,6 +41,15 @@ export function resolveTerminalFontPreference(input: { | ... | @@ -41,6 +41,15 @@ export function resolveTerminalFontPreference(input: { |
| 41 | return input.code; | 41 | return input.code; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | export 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 | |||
| 44 | function quoteFontFamilyName(name: string): string { | 53 | function quoteFontFamilyName(name: string): string { |
| 45 | const bare = name.trim(); | 54 | const bare = name.trim(); |
| 46 | if (bare.length === 0) return ""; | 55 | if (bare.length === 0) return ""; |
apps/web/src/components/ThreadTerminalDrawer.tsx+12-2| ... | @@ -66,7 +66,11 @@ import { terminalEnvironment } from "../state/terminal"; | ... | @@ -66,7 +66,11 @@ import { terminalEnvironment } from "../state/terminal"; |
| 66 | import { openTerminalLinkInPreview } from "./preview/openTerminalLinkInPreview"; | 66 | import { openTerminalLinkInPreview } from "./preview/openTerminalLinkInPreview"; |
| 67 | import { useAtomCommand } from "../state/use-atom-command"; | 67 | import { useAtomCommand } from "../state/use-atom-command"; |
| 68 | import { preventTerminalCloseShortcut } from "../lib/terminalCloseShortcut"; | 68 | import { preventTerminalCloseShortcut } from "../lib/terminalCloseShortcut"; |
| 69 | import { resolveTerminalFontPreference, TYPOGRAPHY_ADVANCED_STORAGE_KEY } from "../appearanceFonts"; | 69 | import { |
| 70 | resolveTerminalFontPreference, | ||
| 71 | resolveTerminalFontSizePreference, | ||
| 72 | TYPOGRAPHY_ADVANCED_STORAGE_KEY, | ||
| 73 | } from "../appearanceFonts"; | ||
| 70 | 74 | ||
| 71 | const MIN_DRAWER_HEIGHT = 180; | 75 | const MIN_DRAWER_HEIGHT = 180; |
| 72 | const MAX_DRAWER_HEIGHT_RATIO = 0.75; | 76 | const MAX_DRAWER_HEIGHT_RATIO = 0.75; |
| ... | @@ -341,7 +345,13 @@ export function TerminalViewport({ | ... | @@ -341,7 +345,13 @@ export function TerminalViewport({ |
| 341 | terminal: settings.fontFamilyTerminal, | 345 | terminal: settings.fontFamilyTerminal, |
| 342 | }), | 346 | }), |
| 343 | ); | 347 | ); |
| 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 | ); | ||
| 345 | const terminalFontRef = useRef({ family: terminalFontFamily, size: terminalFontSize }); | 355 | const terminalFontRef = useRef({ family: terminalFontFamily, size: terminalFontSize }); |
| 346 | const terminalSession = useAttachedTerminalSession({ | 356 | const terminalSession = useAttachedTerminalSession({ |
| 347 | environmentId, | 357 | environmentId, |
apps/web/src/components/settings/SettingsPanels.tsx+6-1| ... | @@ -100,6 +100,7 @@ import { | ... | @@ -100,6 +100,7 @@ import { |
| 100 | isMonospaceFamily, | 100 | isMonospaceFamily, |
| 101 | resolveDefaultFamilyLabel, | 101 | resolveDefaultFamilyLabel, |
| 102 | resolveTerminalFontPreference, | 102 | resolveTerminalFontPreference, |
| 103 | resolveTerminalFontSizePreference, | ||
| 103 | TYPOGRAPHY_ADVANCED_STORAGE_KEY, | 104 | TYPOGRAPHY_ADVANCED_STORAGE_KEY, |
| 104 | } from "../../appearanceFonts"; | 105 | } from "../../appearanceFonts"; |
| 105 | import { CodeFontPreview, PromptFontPreview, TerminalFontPreview } from "./SettingsFontPreviews"; | 106 | import { CodeFontPreview, PromptFontPreview, TerminalFontPreview } from "./SettingsFontPreviews"; |
| ... | @@ -1272,7 +1273,11 @@ function SimpleFontRows() { | ... | @@ -1272,7 +1273,11 @@ function SimpleFontRows() { |
| 1272 | code: settings.fontFamilyCode, | 1273 | code: settings.fontFamilyCode, |
| 1273 | terminal: settings.fontFamilyTerminal, | 1274 | terminal: settings.fontFamilyTerminal, |
| 1274 | })} | 1275 | })} |
| 1275 | size={settings.fontSizeTerminal} | 1276 | size={resolveTerminalFontSizePreference({ |
| 1277 | advanced: false, | ||
| 1278 | code: settings.fontSizeCode, | ||
| 1279 | terminal: settings.fontSizeTerminal, | ||
| 1280 | })} | ||
| 1276 | /> | 1281 | /> |
| 1277 | </> | 1282 | </> |
| 1278 | } | 1283 | } |