diff --git a/crates/ide-core/src/settings.rs b/crates/ide-core/src/settings.rs index 9f0456230..f4d8f62c7 100644 --- a/crates/ide-core/src/settings.rs +++ b/crates/ide-core/src/settings.rs @@ -99,6 +99,20 @@ pub struct AgentSettings { pub smooth_text: bool, /// Conversations and the composer expand to the full width of the pane instead of staying in a centred column. pub fit_window_width: bool, + /// Chat text follows the interface font (Appearance › Use custom font). + pub chat_use_ui_font: bool, + /// Chat text family when it does not follow the interface font. + pub chat_font_family: String, + /// Covers characters the chat font lacks. + pub chat_font_fallback: String, + pub chat_font_size: u32, + /// Code in chat follows the built-in code font. + pub code_use_default_font: bool, + /// Code family when it does not follow the built-in code font. + pub code_font_family: String, + /// Covers characters the code font lacks. + pub code_font_fallback: String, + pub code_font_size: u32, #[serde(deserialize_with = "or_default")] #[specta(type = ThinkingDisplay)] pub thinking: ThinkingDisplay, @@ -145,6 +159,14 @@ impl Default for AgentSettings { show_cost: false, smooth_text: true, fit_window_width: false, + chat_use_ui_font: true, + chat_font_family: "Inter".into(), + chat_font_fallback: String::new(), + chat_font_size: 13, + code_use_default_font: true, + code_font_family: "JetBrains Mono".into(), + code_font_fallback: String::new(), + code_font_size: 13, thinking: ThinkingDisplay::Auto, tool_calls: ToolCallDisplay::Grouped, expand_tool_output: false, diff --git a/src/bindings.ts b/src/bindings.ts index 157187bac..3110ee656 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -3174,6 +3174,20 @@ export type AgentSettings_Deserialize = { smoothText?: boolean, /** Conversations and the composer expand to the full width of the pane instead of staying in a centred column. */ fitWindowWidth?: boolean, + /** Chat text follows the interface font (Appearance › Use custom font). */ + chatUseUiFont?: boolean, + /** Chat text family when it does not follow the interface font. */ + chatFontFamily?: string, + /** Covers characters the chat font lacks. */ + chatFontFallback?: string, + chatFontSize?: number, + /** Code in chat follows the built-in code font. */ + codeUseDefaultFont?: boolean, + /** Code family when it does not follow the built-in code font. */ + codeFontFamily?: string, + /** Covers characters the code font lacks. */ + codeFontFallback?: string, + codeFontSize?: number, thinking?: ThinkingDisplay, toolCalls?: ToolCallDisplay, /** A tool call's output (a command's, a diff) is shown without opening it. */ @@ -3217,6 +3231,20 @@ export type AgentSettings_Serialize = { smoothText: boolean, /** Conversations and the composer expand to the full width of the pane instead of staying in a centred column. */ fitWindowWidth: boolean, + /** Chat text follows the interface font (Appearance › Use custom font). */ + chatUseUiFont: boolean, + /** Chat text family when it does not follow the interface font. */ + chatFontFamily: string, + /** Covers characters the chat font lacks. */ + chatFontFallback: string, + chatFontSize: number, + /** Code in chat follows the built-in code font. */ + codeUseDefaultFont: boolean, + /** Code family when it does not follow the built-in code font. */ + codeFontFamily: string, + /** Covers characters the code font lacks. */ + codeFontFallback: string, + codeFontSize: number, thinking: ThinkingDisplay, toolCalls: ToolCallDisplay, /** A tool call's output (a command's, a diff) is shown without opening it. */ diff --git a/src/features/agents/Home.module.css b/src/features/agents/Home.module.css index f96aab7d3..472953b5c 100644 --- a/src/features/agents/Home.module.css +++ b/src/features/agents/Home.module.css @@ -12,6 +12,7 @@ padding: 24px 24px 12vh; background: var(--bg-editor); color: var(--fg); + font-family: var(--agent-font-ui, var(--font-ui)); } .inner { /* A compact block in the middle of the page: narrower than a session's conversation. */ diff --git a/src/features/agents/Session.module.css b/src/features/agents/Session.module.css index b3b7100bf..540f72a8c 100644 --- a/src/features/agents/Session.module.css +++ b/src/features/agents/Session.module.css @@ -11,7 +11,8 @@ grid-template-columns: minmax(0, 1fr); background: var(--bg-app); color: var(--fg); - font-size: var(--fs-ui); + font-family: var(--agent-font-ui, var(--font-ui)); + font-size: var(--agent-fs-ui); } .conversation { @@ -523,7 +524,7 @@ transform: translateX(0); } .markdown :global(code) { - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-small, var(--fs-small)); border-radius: var(--radius-small); background: var(--md-code-bg); @@ -543,6 +544,8 @@ display: block; background: none; box-shadow: none; + /* A chosen code size wins over the chat-derived one; inline code stays with the chat. */ + font-size: var(--agent-fs-code-chosen, var(--agent-fs-small, var(--fs-small))); } .codeBlock { position: relative; @@ -635,7 +638,7 @@ border-radius: var(--radius-small); background: var(--bg-elev); color: var(--danger); - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-small, var(--fs-small)); text-align: left; white-space: pre-wrap; @@ -939,7 +942,7 @@ border-radius: var(--radius-small); border: 1px solid var(--border); background: var(--bg-elev); - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-small, var(--fs-small)); white-space: pre-wrap; overflow-wrap: anywhere; @@ -1006,7 +1009,7 @@ border-radius: var(--radius-small); background: var(--bg-editor); color: var(--fg); - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-code, var(--fs-code)); line-height: calc(var(--lh-code) + var(--agent-font-zoom, 0px) * 1.6); white-space: pre-wrap; @@ -1045,7 +1048,7 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-small, var(--fs-small)); } .permissionDone { @@ -1385,7 +1388,7 @@ .changeCommitHash { flex: none; color: var(--fg-subtle); - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); } .changeCommitSummary { flex: 1 1 0; @@ -1469,7 +1472,7 @@ .subagentActivity { padding-left: 22px; color: var(--fg-muted); - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-small, var(--fs-small)); white-space: nowrap; overflow: hidden; @@ -1769,7 +1772,7 @@ border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--bg-editor); - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-code, var(--fs-code)); } .questionPreviewEmpty { @@ -1949,7 +1952,7 @@ .exitCode { flex: none; color: var(--danger); - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-small, var(--fs-small)); } .terminalBlock { @@ -1963,7 +1966,7 @@ .terminalOutput { margin: 0; padding: 6px 10px; - font-family: var(--font-mono); + font-family: var(--agent-font-code, var(--font-mono)); font-size: var(--agent-fs-small, var(--fs-small)); white-space: pre-wrap; word-break: break-word; diff --git a/src/features/agents/agentSettings.ts b/src/features/agents/agentSettings.ts index cc5d14cd3..d35d1654e 100644 --- a/src/features/agents/agentSettings.ts +++ b/src/features/agents/agentSettings.ts @@ -12,6 +12,14 @@ export const AGENT_SETTINGS_DEFAULTS: ResolvedAgentSettings = { showCost: false, smoothText: true, fitWindowWidth: false, + chatUseUiFont: true, + chatFontFamily: "Inter", + chatFontFallback: "", + chatFontSize: 13, + codeUseDefaultFont: true, + codeFontFamily: "JetBrains Mono", + codeFontFallback: "", + codeFontSize: 13, thinking: "auto", toolCalls: "grouped", expandToolOutput: false, diff --git a/src/features/agents/fontZoom.test.tsx b/src/features/agents/fontZoom.test.tsx index 639af7c3a..c6621d857 100644 --- a/src/features/agents/fontZoom.test.tsx +++ b/src/features/agents/fontZoom.test.tsx @@ -55,7 +55,10 @@ vi.mock("@/platform/ipc", async (original) => ({ }, agentEntries: async () => ({ status: "ok", data: [] as AgentEntry[] }), agentChanges: async () => ({ status: "ok", data: [] }), - agentGroupedChanges: async () => ({ status: "ok", data: { uncommitted: [], commits: [] } }), + agentGroupedChanges: async () => ({ + status: "ok", + data: { uncommitted: [], commits: [] }, + }), agentProviders: async () => ({ status: "ok", data: [] }), vcsBranchInfo: async () => ({ status: "ok", data: { head: "main" } }), vcsBranches: async () => ({ status: "ok", data: [] }), @@ -94,9 +97,19 @@ describe("Agent chat font size zoom", () => { resetAllAgentFontZoom(); imageReads.clear(); disposers.push(registerEditorActions()); - useContextKeys.setState({ projectOpen: true, textEditorActive: false, editorFocus: true, popupOpen: false }); + useContextKeys.setState({ + projectOpen: true, + textEditorActive: false, + editorFocus: true, + popupOpen: false, + }); useProject.setState({ - project: { name: "openidea", root: "/project", isGit: true, workspace: null } as never, + project: { + name: "openidea", + root: "/project", + isGit: true, + workspace: null, + } as never, settings: null, }); const t1 = makeTask("t1"); @@ -132,13 +145,25 @@ describe("Agent chat font size zoom", () => {
- +
- + @@ -146,7 +171,13 @@ describe("Agent chat font size zoom", () => {
- +
@@ -223,7 +254,12 @@ describe("Agent chat font size zoom", () => { uiMode: null, readOnly: false, }; - const view = new EditorView({ state: EditorState.create({ doc: "const x = 1;", extensions: [cmFontZoom] }) }); + const view = new EditorView({ + state: EditorState.create({ + doc: "const x = 1;", + extensions: [cmFontZoom], + }), + }); document.body.appendChild(view.dom); const handle = { view, ctx }; _addEditor(handle); @@ -235,7 +271,14 @@ describe("Agent chat font size zoom", () => { activeSlot = { view, disposed: false }; const { container } = render( - , + , ); const stream = container.querySelector(`.${styles.stream}`)!; @@ -270,17 +313,34 @@ describe("Agent chat font size zoom", () => { const { container } = render(
- + - +
, ); const streams = container.querySelectorAll(`.${styles.stream}`); const stream1 = streams[0]!; - const offEvent = new WheelEvent("wheel", { bubbles: true, cancelable: true, metaKey: true, deltaY: -100 }); + const offEvent = new WheelEvent("wheel", { + bubbles: true, + cancelable: true, + metaKey: true, + deltaY: -100, + }); act(() => { stream1.dispatchEvent(offEvent); }); @@ -294,21 +354,35 @@ describe("Agent chat font size zoom", () => { })), ); - const up = new WheelEvent("wheel", { bubbles: true, cancelable: true, metaKey: true, deltaY: -100 }); + const up = new WheelEvent("wheel", { + bubbles: true, + cancelable: true, + metaKey: true, + deltaY: -100, + }); act(() => { stream1.dispatchEvent(up); }); expect(up.defaultPrevented).toBe(true); expect(useAgentFontZoom.getState().bySurface).toEqual({ "tab:tab-1": 1 }); - const down = new WheelEvent("wheel", { bubbles: true, cancelable: true, ctrlKey: true, deltaY: 100 }); + const down = new WheelEvent("wheel", { + bubbles: true, + cancelable: true, + ctrlKey: true, + deltaY: 100, + }); act(() => { stream1.dispatchEvent(down); }); expect(down.defaultPrevented).toBe(true); expect(useAgentFontZoom.getState().bySurface).toEqual({}); - const plain = new WheelEvent("wheel", { bubbles: true, cancelable: true, deltaY: -100 }); + const plain = new WheelEvent("wheel", { + bubbles: true, + cancelable: true, + deltaY: -100, + }); act(() => { stream1.dispatchEvent(plain); }); @@ -324,13 +398,29 @@ describe("Agent chat font size zoom", () => { act(() => useAgents.setState((s) => ({ ...s, - entries: new Map([["t1", [{ type: "agent", text: "![Diagram](diagram.svg)\n\n![Shot](shot.png)" }]]]), + entries: new Map([ + [ + "t1", + [ + { + type: "agent", + text: "![Diagram](diagram.svg)\n\n![Shot](shot.png)", + }, + ], + ], + ]), })), ); const { container } = render( - + , ); @@ -344,8 +434,14 @@ describe("Agent chat font size zoom", () => { expect(diag.style.getPropertyValue("--image-width")).toBe("320px"); const shot = container.querySelector('img[alt="Shot"]')!; - Object.defineProperty(shot, "naturalWidth", { value: 640, configurable: true }); - Object.defineProperty(shot, "naturalHeight", { value: 360, configurable: true }); + Object.defineProperty(shot, "naturalWidth", { + value: 640, + configurable: true, + }); + Object.defineProperty(shot, "naturalHeight", { + value: 360, + configurable: true, + }); act(() => { shot.dispatchEvent(new Event("load")); }); @@ -353,6 +449,54 @@ describe("Agent chat font size zoom", () => { expect(shot.style.getPropertyValue("--image-width")).toBe("640px"); }); + it("applies the Agents › Chat font choices as surface variables, with zoom on top of the chosen size", () => { + const { container } = render( + + + , + ); + const session = container.querySelector(`.${styles.session}`)!; + // Defaults follow the interface and built-in code fonts: no surface overrides. + expect(session.style.getPropertyValue("--agent-font-ui")).toBe(""); + expect(session.style.getPropertyValue("--agent-font-code")).toBe(""); + expect(session.style.getPropertyValue("--agent-fs-code-chosen")).toBe(""); + + act(() => + useProject.setState((s) => ({ + ...s, + settings: { + agents: { + chatUseUiFont: false, + chatFontFamily: "Maple Mono NF CN", + chatFontFallback: "PingFang SC", + chatFontSize: 16, + codeUseDefaultFont: false, + codeFontFamily: "Hack", + codeFontSize: 15, + }, + } as never, + })), + ); + expect(session.style.getPropertyValue("--agent-font-ui")).toContain('"Maple Mono NF CN"'); + expect(session.style.getPropertyValue("--agent-font-ui")).toContain('"PingFang SC"'); + expect(session.style.getPropertyValue("--agent-fs-ui")).toBe("calc(16px + var(--agent-font-zoom, 0px))"); + expect(session.style.getPropertyValue("--agent-fs-small")).toBe("calc(15px + var(--agent-font-zoom, 0px))"); + expect(session.style.getPropertyValue("--agent-font-code")).toContain('"Hack"'); + expect(session.style.getPropertyValue("--agent-fs-code")).toBe("calc(15px + var(--agent-font-zoom, 0px))"); + expect(session.style.getPropertyValue("--agent-fs-code-chosen")).toBe("var(--agent-fs-code)"); + expect(session.style.getPropertyValue("--lh-code")).toBe("25px"); + + // Keyboard zoom steps on top of the chosen chat size, not the interface size. + act(() => stepAgentSurfaceFontZoom("agent:t1", 2)); + expect(session.style.getPropertyValue("--markdown-zoom-scale")).toBe("1.125"); + }); + it("prunes bySurface entries when a tab closes or a task is removed", () => { stepAgentSurfaceFontZoom("tab:tab-a", 4); stepAgentSurfaceFontZoom("tab:tab-b", -2); diff --git a/src/features/agents/fontZoom.ts b/src/features/agents/fontZoom.ts index df6391aef..66e1910af 100644 --- a/src/features/agents/fontZoom.ts +++ b/src/features/agents/fontZoom.ts @@ -1,9 +1,11 @@ import { useEffect, type CSSProperties, type RefObject } from "react"; import { create } from "zustand"; import { editorPrefs } from "@/platform/editorSettings"; +import { monoFontFamily, uiFontFamily } from "@/platform/fonts"; import { useProject } from "@/platform/project"; import { registerFontZoomSurface, useEditorShown, useEditorTabId, useToolWindowShown } from "@/workbench/contributions"; import { wheelZoomStep } from "@/platform/wheelZoom"; +import { useAgentSettings } from "./agentSettings"; const MIN_FONT_ZOOM = -6; const MAX_FONT_ZOOM = 36; @@ -49,7 +51,11 @@ export function resetAllAgentFontZoom(): void { function uiFontSizeOf(settings: unknown): number { if (!settings || typeof settings !== "object") return DEFAULT_UI_FONT_SIZE; - const a = (settings as { appearance?: { useCustomFont?: unknown; uiFontSize?: unknown } }).appearance; + const a = ( + settings as { + appearance?: { useCustomFont?: unknown; uiFontSize?: unknown }; + } + ).appearance; return a?.useCustomFont && typeof a.uiFontSize === "number" && a.uiFontSize > 0 ? a.uiFontSize : DEFAULT_UI_FONT_SIZE; } @@ -69,7 +75,9 @@ export function useAgentFontZoomSurface( const surfaceKey = agentSurfaceZoomKey(fallbackKey, docked, tabId); const active = enabled && (docked ? toolWindowShown : editorShown); const fontZoom = useAgentFontZoom((s) => s.bySurface[surfaceKey] ?? 0); - const baseSize = useProject((s) => uiFontSizeOf(s.settings)); + const uiBaseSize = useProject((s) => uiFontSizeOf(s.settings)); + const agents = useAgentSettings(); + const baseSize = agents.chatUseUiFont ? uiBaseSize : agents.chatFontSize; useEffect(() => { const el = ref.current; if (!active || !el) return; @@ -93,6 +101,23 @@ export function useAgentFontZoomSurface( const zoomStyle = { "--agent-font-zoom": `${fontZoom}px`, "--markdown-zoom-scale": String(zoomScale), + ...(agents.chatUseUiFont + ? {} + : { + "--agent-font-ui": `${uiFontFamily(agents.chatFontFamily, agents.chatFontFallback)}, var(--font-icons)`, + "--agent-fs-ui": `calc(${agents.chatFontSize}px + var(--agent-font-zoom, 0px))`, + "--agent-fs-small": `calc(${agents.chatFontSize - 1}px + var(--agent-font-zoom, 0px))`, + }), + ...(agents.codeUseDefaultFont + ? {} + : { + "--agent-font-code": monoFontFamily(agents.codeFontFamily, agents.codeFontFallback, "var(--font-mono)"), + "--agent-fs-code": `calc(${agents.codeFontSize}px + var(--agent-font-zoom, 0px))`, + // Fenced code blocks follow the chosen code size; without one they stay chat-derived. + "--agent-fs-code-chosen": "var(--agent-fs-code)", + // Keep the bundled 13px/22px code ratio at the chosen size. + "--lh-code": `${Math.round((agents.codeFontSize * 22) / 13)}px`, + }), } as CSSProperties; return { fontZoom, zoomStyle }; } diff --git a/src/features/settings/__tests__/agents.test.ts b/src/features/settings/__tests__/agents.test.ts index c3229bcbb..ca4fadfe4 100644 --- a/src/features/settings/__tests__/agents.test.ts +++ b/src/features/settings/__tests__/agents.test.ts @@ -16,6 +16,14 @@ describe("agent chat settings", () => { sendWith: "enter", whileRunning: "queue", newTaskApprovals: "bypass", + chatUseUiFont: true, + chatFontFamily: "Inter", + chatFontFallback: "", + chatFontSize: 13, + codeUseDefaultFont: true, + codeFontFamily: "JetBrains Mono", + codeFontFallback: "", + codeFontSize: 13, defaults: {}, mcpServers: {}, skills: {}, @@ -31,6 +39,11 @@ describe("agent chat settings", () => { fitWindowWidth: true, }); expect(validateSettings({ agents: { fitWindowWidth: "yes" } }).agents.fitWindowWidth).toBe(false); + const fonts = validateSettings({ + agents: { chatUseUiFont: false, chatFontFamily: "Maple Mono NF CN", chatFontSize: 16, codeFontSize: 999 }, + }).agents; + expect(fonts).toMatchObject({ chatUseUiFont: false, chatFontFamily: "Maple Mono NF CN", chatFontSize: 16 }); + expect(fonts.codeFontSize).toBe(72); }); it("keeps valid chat choices and per-agent defaults", () => { diff --git a/src/features/settings/model/schema.ts b/src/features/settings/model/schema.ts index cf6bb0f92..8a072a825 100644 --- a/src/features/settings/model/schema.ts +++ b/src/features/settings/model/schema.ts @@ -242,6 +242,14 @@ export const DEFAULT_SETTINGS: ValidSettings = { showCost: false, smoothText: true, fitWindowWidth: false, + chatUseUiFont: true, + chatFontFamily: "Inter", + chatFontFallback: "", + chatFontSize: 13, + codeUseDefaultFont: true, + codeFontFamily: "JetBrains Mono", + codeFontFallback: "", + codeFontSize: 13, thinking: "auto", toolCalls: "grouped", expandToolOutput: false, @@ -458,6 +466,14 @@ export function validateSettings(raw: Settings | unknown): ValidSettings { showCost: bool(agents.showCost, d.agents.showCost), smoothText: bool(agents.smoothText, d.agents.smoothText), fitWindowWidth: bool(agents.fitWindowWidth, d.agents.fitWindowWidth), + chatUseUiFont: bool(agents.chatUseUiFont, d.agents.chatUseUiFont), + chatFontFamily: str(agents.chatFontFamily, d.agents.chatFontFamily), + chatFontFallback: str(agents.chatFontFallback, d.agents.chatFontFallback), + chatFontSize: num(agents.chatFontSize, d.agents.chatFontSize, LIMITS.fontSize, true), + codeUseDefaultFont: bool(agents.codeUseDefaultFont, d.agents.codeUseDefaultFont), + codeFontFamily: str(agents.codeFontFamily, d.agents.codeFontFamily), + codeFontFallback: str(agents.codeFontFallback, d.agents.codeFontFallback), + codeFontSize: num(agents.codeFontSize, d.agents.codeFontSize, LIMITS.fontSize, true), thinking: oneOf(agents.thinking, ["auto", "expanded", "collapsed"] as const, d.agents.thinking), toolCalls: oneOf(agents.toolCalls, ["grouped", "each"] as const, d.agents.toolCalls), expandToolOutput: bool(agents.expandToolOutput, d.agents.expandToolOutput), diff --git a/src/features/settings/pages/tools.tsx b/src/features/settings/pages/tools.tsx index 5ccd34693..b07e74701 100644 --- a/src/features/settings/pages/tools.tsx +++ b/src/features/settings/pages/tools.tsx @@ -353,6 +353,113 @@ function TerminalFont() { ); } +// --------------------------------------------------------------------------- +// Agents › Chat + +function ChatTextFont() { + const [useUi, setUseUi] = useSetting("agents.chatUseUiFont"); + const [family, setFamily] = useSetting("agents.chatFontFamily"); + const [fallback, setFallback] = useSetting("agents.chatFontFallback"); + const [size, setSize] = useSetting("agents.chatFontSize"); + const matched = useLabelMatch("Use interface font"); + return ( + <> +
+ } /> + + configured in{" "} + + Appearance + + +
+
+ + + + + + +
+
+ + + +
+ + ); +} + +function ChatCodeFont() { + const [useDefault, setUseDefault] = useSetting("agents.codeUseDefaultFont"); + const [family, setFamily] = useSetting("agents.codeFontFamily"); + const [fallback, setFallback] = useSetting("agents.codeFontFallback"); + const [size, setSize] = useSetting("agents.codeFontSize"); + const matched = useLabelMatch("Use default code font"); + const monoMatched = useLabelMatch("Show only monospaced fonts"); + const [monoSetting, setMonoOnly] = useSetting("editor.onlyMonospacedFonts"); + const monoOnly = monoSetting !== false; + return ( + <> +
+ } /> + JetBrains Mono +
+
+ + + + + } + /> + + + + + + +
+
+ + + +
+ + ); +} + // --------------------------------------------------------------------------- // Actions on Save @@ -783,6 +890,7 @@ export const TOOLS_PAGES: PageSpec[] = [ "permission", "bypass", "width", + "font", ], sections: [ { @@ -857,6 +965,28 @@ export const TOOLS_PAGES: PageSpec[] = [ }, ], }, + { + title: "Font", + options: [ + { + kind: "custom", + label: "Use interface font", + keywords: ["Chat text", "Font", "Fallback font", "Size"], + component: ChatTextFont, + }, + ], + }, + { + title: "Code Font", + options: [ + { + kind: "custom", + label: "Use default code font", + keywords: ["Code", "Font", "Fallback font", "Size", "Show only monospaced fonts", "monospace"], + component: ChatCodeFont, + }, + ], + }, ], }, { diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index 7d94d280c..989178d30 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -2009,6 +2009,15 @@ "{names} needs {name} and stops while it is disabled. Disable it anyway?": "{names} needs {name} and stops while it is disabled. Disable it anyway?", "{refactoring} needs {name}. Install it via {method}?": "{refactoring} needs {name}. Install it via {method}?", "Appearance": "Appearance", + "Use interface font": "Use interface font", + "Use default code font": "Use default code font", + "Code Font": "Code Font", + "Chat font": "Chat font", + "Chat fallback font": "Chat fallback font", + "Chat font size": "Chat font size", + "Chat code font": "Chat code font", + "Chat code fallback font": "Chat code fallback font", + "Chat code font size": "Chat code font size", "Behavior": "Behavior", "Sort By": "Sort By", "Type": "Type", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index fac82e4ba..25be07196 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -3861,7 +3861,9 @@ "Use contrast scrollbars": "使用对比度滚动条", "Use custom font": "使用自定义字体", "Use custom font:": "使用自定义字体:", + "Use default code font": "使用默认代码字体", "Use editor font": "使用编辑器字体", + "Use interface font": "使用界面字体", "Use lighter color in the dark theme and darker color in the light theme as a background": "在深色主题中使用较浅的颜色、在浅色主题中使用较深的颜色作为背景", "Use original line's indent for wrapped parts": "换行部分使用原始行的缩进", "Use pretty formatting": "使用友好格式", @@ -7433,6 +7435,13 @@ "Weekly Opus limit": "每周 Opus 限额", "Weekly Sonnet limit": "每周 Sonnet 限额", "Chat": "聊天", + "Code Font": "代码字体", + "Chat font": "聊天字体", + "Chat fallback font": "聊天备用字体", + "Chat font size": "聊天字体大小", + "Chat code font": "聊天代码字体", + "Chat code fallback font": "聊天代码备用字体", + "Chat code font size": "聊天代码字体大小", "Shown in the Task Header": "在任务标题栏中显示", "Context window usage": "上下文窗口用量", "Usage limits": "用量限额", diff --git a/src/platform/workflowSettings.ts b/src/platform/workflowSettings.ts index 8bfbf2010..60efa4353 100644 --- a/src/platform/workflowSettings.ts +++ b/src/platform/workflowSettings.ts @@ -279,6 +279,8 @@ export const WORKFLOW_LIMITS = { terminalFontSize: { min: 6, max: 72 }, terminalLineHeight: { min: 0.5, max: 3 }, terminalColumnWidth: { min: 0.5, max: 2 }, + agentChatFontSize: { min: 6, max: 72 }, + agentCodeFontSize: { min: 6, max: 72 }, } as const; export const DEFAULT_EXTERNAL_TOOL: ExternalToolValid = {