Skip to content

Commit a046159

Browse files
fix(settings): scope chat font size to the chat markdown surface (#157)
1 parent 48b680d commit a046159

3 files changed

Lines changed: 40 additions & 9 deletions

File tree

webview-ui/src/components/common/MarkdownBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const StyledMarkdown = styled.div`
8383
"Helvetica Neue",
8484
sans-serif;
8585
86-
font-size: var(--vscode-font-size, 13px);
86+
font-size: var(--zoo-chat-font-size, var(--vscode-font-size, 13px));
8787
8888
p,
8989
li,

webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,37 @@ describe("SettingsView - Sound Settings", () => {
412412
)
413413
})
414414

415+
it("saves the selected chat font size and persists null on reset", () => {
416+
const { activateTab, getSettingsContent } = renderSettingsView()
417+
418+
activateTab("ui")
419+
420+
const content = getSettingsContent()
421+
const slider = within(content).getByTestId("chat-font-size-slider")
422+
423+
// Pick a size, then Save — the boundary should forward it to the host.
424+
fireEvent.change(slider, { target: { value: "18" } })
425+
fireEvent.click(screen.getByTestId("save-button"))
426+
427+
expect(vscode.postMessage).toHaveBeenCalledWith(
428+
expect.objectContaining({
429+
type: "updateSettings",
430+
updatedSettings: expect.objectContaining({ chatFontSize: 18 }),
431+
}),
432+
)
433+
434+
// Reset clears the override; it is persisted as null (not undefined).
435+
fireEvent.click(within(getSettingsContent()).getByTestId("chat-font-size-reset"))
436+
fireEvent.click(screen.getByTestId("save-button"))
437+
438+
expect(vscode.postMessage).toHaveBeenCalledWith(
439+
expect.objectContaining({
440+
type: "updateSettings",
441+
updatedSettings: expect.objectContaining({ chatFontSize: null }),
442+
}),
443+
)
444+
})
445+
415446
it("shows tts slider when sound is enabled", () => {
416447
// Render once and get the activateTab helper
417448
const { activateTab, getSettingsContent } = renderSettingsView()

webview-ui/src/index.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
@theme {
2626
--font-display: var(--vscode-font-family);
2727

28-
--text-xs: calc(var(--zoo-chat-font-size) * 0.85);
29-
--text-sm: calc(var(--zoo-chat-font-size) * 0.9);
30-
--text-base: var(--zoo-chat-font-size);
31-
--text-lg: calc(var(--zoo-chat-font-size) * 1.1);
28+
--text-xs: calc(var(--vscode-font-size) * 0.85);
29+
--text-sm: calc(var(--vscode-font-size) * 0.9);
30+
--text-base: var(--vscode-font-size);
31+
--text-lg: calc(var(--vscode-font-size) * 1.1);
3232

3333
--color-background: var(--background);
3434
--color-foreground: var(--foreground);
@@ -254,17 +254,17 @@ html {
254254
-webkit-font-smoothing: antialiased;
255255
-moz-osx-font-smoothing: grayscale;
256256
/*
257-
* Base font size for the Zoo Code chat/webview UI. Defaults to VS Code's
258-
* font size so appearance is unchanged unless the user configures the
259-
* "Chat font size" setting, which overrides this variable at runtime.
257+
* Font size for the Zoo Code chat message surface (consumed by MarkdownBlock).
258+
* Defaults to VS Code's font size so appearance is unchanged unless the user
259+
* configures the "Chat font size" setting, which overrides this variable at
260+
* runtime. Scoped to chat rendering so it does not resize settings/other UI.
260261
*/
261262
--zoo-chat-font-size: var(--vscode-font-size);
262263
}
263264

264265
body {
265266
margin: 0;
266267
line-height: 1.25;
267-
font-size: var(--zoo-chat-font-size);
268268
}
269269

270270
body.scrollable,

0 commit comments

Comments
 (0)