fix(web): inherit terminal size in simple typography (#5628)
This commit is contained in:
1 parent
ed886fe181
commit
daf8ee0b2f
4 files changed
+38
-3
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
cssFontFamilies,
|
||||
resolveDefaultFamilyLabel,
|
||||
resolveTerminalFontPreference,
|
||||
resolveTerminalFontSizePreference,
|
||||
} from "./appearanceFonts";
|
||||
|
||||
describe("areFontAdvancesMonospace", () => {
|
||||
@@ -97,6 +98,16 @@ describe("resolveTerminalFontPreference", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveTerminalFontSizePreference", () => {
|
||||
it("inherits the code font size in simple mode", () => {
|
||||
expect(resolveTerminalFontSizePreference({ advanced: false, code: 15, terminal: 12 })).toBe(15);
|
||||
});
|
||||
|
||||
it("keeps code and terminal font sizes independent in advanced mode", () => {
|
||||
expect(resolveTerminalFontSizePreference({ advanced: true, code: 15, terminal: 12 })).toBe(12);
|
||||
});
|
||||
});
|
||||
|
||||
describe("font size clamping", () => {
|
||||
it("keeps sizes inside the ranges the UI can absorb", () => {
|
||||
expect(clampInterfaceFontSize(16)).toBe(16);
|
||||
|
||||
@@ -41,6 +41,15 @@ export function resolveTerminalFontPreference(input: {
|
||||
return input.code;
|
||||
}
|
||||
|
||||
export function resolveTerminalFontSizePreference(input: {
|
||||
readonly advanced: boolean;
|
||||
readonly code: number;
|
||||
readonly terminal: number;
|
||||
}): number {
|
||||
if (input.advanced) return input.terminal;
|
||||
return input.code;
|
||||
}
|
||||
|
||||
function quoteFontFamilyName(name: string): string {
|
||||
const bare = name.trim();
|
||||
if (bare.length === 0) return "";
|
||||
|
||||
@@ -66,7 +66,11 @@ import { terminalEnvironment } from "../state/terminal";
|
||||
import { openTerminalLinkInPreview } from "./preview/openTerminalLinkInPreview";
|
||||
import { useAtomCommand } from "../state/use-atom-command";
|
||||
import { preventTerminalCloseShortcut } from "../lib/terminalCloseShortcut";
|
||||
import { resolveTerminalFontPreference, TYPOGRAPHY_ADVANCED_STORAGE_KEY } from "../appearanceFonts";
|
||||
import {
|
||||
resolveTerminalFontPreference,
|
||||
resolveTerminalFontSizePreference,
|
||||
TYPOGRAPHY_ADVANCED_STORAGE_KEY,
|
||||
} from "../appearanceFonts";
|
||||
|
||||
const MIN_DRAWER_HEIGHT = 180;
|
||||
const MAX_DRAWER_HEIGHT_RATIO = 0.75;
|
||||
@@ -341,7 +345,13 @@ export function TerminalViewport({
|
||||
terminal: settings.fontFamilyTerminal,
|
||||
}),
|
||||
);
|
||||
const terminalFontSize = useClientSettings((settings) => settings.fontSizeTerminal);
|
||||
const terminalFontSize = useClientSettings((settings) =>
|
||||
resolveTerminalFontSizePreference({
|
||||
advanced: advancedTypography,
|
||||
code: settings.fontSizeCode,
|
||||
terminal: settings.fontSizeTerminal,
|
||||
}),
|
||||
);
|
||||
const terminalFontRef = useRef({ family: terminalFontFamily, size: terminalFontSize });
|
||||
const terminalSession = useAttachedTerminalSession({
|
||||
environmentId,
|
||||
|
||||
@@ -100,6 +100,7 @@ import {
|
||||
isMonospaceFamily,
|
||||
resolveDefaultFamilyLabel,
|
||||
resolveTerminalFontPreference,
|
||||
resolveTerminalFontSizePreference,
|
||||
TYPOGRAPHY_ADVANCED_STORAGE_KEY,
|
||||
} from "../../appearanceFonts";
|
||||
import { CodeFontPreview, PromptFontPreview, TerminalFontPreview } from "./SettingsFontPreviews";
|
||||
@@ -1272,7 +1273,11 @@ function SimpleFontRows() {
|
||||
code: settings.fontFamilyCode,
|
||||
terminal: settings.fontFamilyTerminal,
|
||||
})}
|
||||
size={settings.fontSizeTerminal}
|
||||
size={resolveTerminalFontSizePreference({
|
||||
advanced: false,
|
||||
code: settings.fontSizeCode,
|
||||
terminal: settings.fontSizeTerminal,
|
||||
})}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user