Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit aecec67

Browse files
committed
feat(ui): add chat font size multiplier setting
- Add chatFontSizeMultiplier to global settings with min 0.5 max 2 bounds - Add commands: increaseChatFontSize, decreaseChatFontSize, resetChatFontSize - Add UI Settings control with number input and reset button - Apply font size multiplier only to ChatView container (scoped per Bruno feedback) - Add English translations for the new setting - Update UISettings tests Addresses issue #8100 per feedback from Bruno in PR #8457
1 parent 618aa66 commit aecec67

13 files changed

Lines changed: 170 additions & 2 deletions

File tree

‎packages/types/src/global-settings.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ export const globalSettingsSchema = z.object({
207207
* @default "send"
208208
*/
209209
enterBehavior: z.enum(["send", "newline"]).optional(),
210+
/**
211+
* Multiplier for the chat view font size.
212+
* - Min: 0.5, Max: 2.0
213+
* @default 1.0
214+
*/
215+
chatFontSizeMultiplier: z.number().min(0.5).max(2).optional(),
210216
profileThresholds: z.record(z.string(), z.number()).optional(),
211217
hasOpenedModeSelector: z.boolean().optional(),
212218
lastModeExportPath: z.string().optional(),

‎packages/types/src/vscode-extension-host.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ export type ExtensionState = Pick<
299299
| "includeTaskHistoryInEnhance"
300300
| "reasoningBlockCollapsed"
301301
| "enterBehavior"
302+
| "chatFontSizeMultiplier"
302303
| "includeCurrentTime"
303304
| "includeCurrentCost"
304305
| "maxGitStatusFiles"

‎packages/types/src/vscode.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export const commandIds = [
4747
"acceptInput",
4848
"focusPanel",
4949
"toggleAutoApprove",
50+
51+
"increaseChatFontSize",
52+
"decreaseChatFontSize",
53+
"resetChatFontSize",
5054
] as const
5155

5256
export type CommandId = (typeof commandIds)[number]

‎src/activate/registerCommands.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,40 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
195195
action: "toggleAutoApprove",
196196
})
197197
},
198+
increaseChatFontSize: async () => {
199+
const visibleProvider = getVisibleProviderOrLog(outputChannel)
200+
201+
if (!visibleProvider) {
202+
return
203+
}
204+
205+
const currentMultiplier = visibleProvider.contextProxy.getValue("chatFontSizeMultiplier") ?? 1
206+
const newMultiplier = Math.min(2, currentMultiplier + 0.1)
207+
await visibleProvider.contextProxy.setValue("chatFontSizeMultiplier", newMultiplier)
208+
await visibleProvider.postStateToWebview()
209+
},
210+
decreaseChatFontSize: async () => {
211+
const visibleProvider = getVisibleProviderOrLog(outputChannel)
212+
213+
if (!visibleProvider) {
214+
return
215+
}
216+
217+
const currentMultiplier = visibleProvider.contextProxy.getValue("chatFontSizeMultiplier") ?? 1
218+
const newMultiplier = Math.max(0.5, currentMultiplier - 0.1)
219+
await visibleProvider.contextProxy.setValue("chatFontSizeMultiplier", newMultiplier)
220+
await visibleProvider.postStateToWebview()
221+
},
222+
resetChatFontSize: async () => {
223+
const visibleProvider = getVisibleProviderOrLog(outputChannel)
224+
225+
if (!visibleProvider) {
226+
return
227+
}
228+
229+
await visibleProvider.contextProxy.setValue("chatFontSizeMultiplier", 1)
230+
await visibleProvider.postStateToWebview()
231+
},
198232
})
199233

200234
export const openClineInNewTab = async ({ context, outputChannel }: Omit<RegisterCommandOptions, "provider">) => {

‎src/core/webview/ClineProvider.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,6 +2174,7 @@ export class ClineProvider
21742174
historyPreviewCollapsed,
21752175
reasoningBlockCollapsed,
21762176
enterBehavior,
2177+
chatFontSizeMultiplier,
21772178
cloudUserInfo,
21782179
cloudIsAuthenticated,
21792180
sharingEnabled,
@@ -2300,6 +2301,7 @@ export class ClineProvider
23002301
historyPreviewCollapsed: historyPreviewCollapsed ?? false,
23012302
reasoningBlockCollapsed: reasoningBlockCollapsed ?? true,
23022303
enterBehavior: enterBehavior ?? "send",
2304+
chatFontSizeMultiplier: chatFontSizeMultiplier ?? 1,
23032305
cloudUserInfo,
23042306
cloudIsAuthenticated: cloudIsAuthenticated ?? false,
23052307
cloudAuthSkipModel: this.context.globalState.get<boolean>("roo-auth-skip-model") ?? false,
@@ -2523,6 +2525,7 @@ export class ClineProvider
25232525
historyPreviewCollapsed: stateValues.historyPreviewCollapsed ?? false,
25242526
reasoningBlockCollapsed: stateValues.reasoningBlockCollapsed ?? true,
25252527
enterBehavior: stateValues.enterBehavior ?? "send",
2528+
chatFontSizeMultiplier: stateValues.chatFontSizeMultiplier ?? 1,
25262529
cloudUserInfo,
25272530
cloudIsAuthenticated,
25282531
sharingEnabled,

‎src/package.json‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,21 @@
169169
"command": "roo-cline.toggleAutoApprove",
170170
"title": "%command.toggleAutoApprove.title%",
171171
"category": "%configuration.title%"
172+
},
173+
{
174+
"command": "roo-cline.increaseChatFontSize",
175+
"title": "%command.increaseChatFontSize.title%",
176+
"category": "%configuration.title%"
177+
},
178+
{
179+
"command": "roo-cline.decreaseChatFontSize",
180+
"title": "%command.decreaseChatFontSize.title%",
181+
"category": "%configuration.title%"
182+
},
183+
{
184+
"command": "roo-cline.resetChatFontSize",
185+
"title": "%command.resetChatFontSize.title%",
186+
"category": "%configuration.title%"
172187
}
173188
],
174189
"menus": {

‎src/package.nls.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
"command.terminal.explainCommand.title": "Explain This Command",
2626
"command.acceptInput.title": "Accept Input/Suggestion",
2727
"command.toggleAutoApprove.title": "Toggle Auto-Approve",
28+
"command.increaseChatFontSize.title": "Increase Chat Font Size",
29+
"command.decreaseChatFontSize.title": "Decrease Chat Font Size",
30+
"command.resetChatFontSize.title": "Reset Chat Font Size",
2831
"configuration.title": "Roo Code",
2932
"commands.allowedCommands.description": "Commands that can be auto-executed when 'Always approve execute operations' is enabled",
3033
"commands.deniedCommands.description": "Command prefixes that will be automatically denied without asking for approval. In case of conflicts with allowed commands, the longest prefix match takes precedence. Add * to deny all commands.",

‎webview-ui/src/components/chat/ChatView.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
9393
cloudIsAuthenticated,
9494
messageQueue = [],
9595
showWorktreesInHomeScreen,
96+
chatFontSizeMultiplier,
9697
} = useExtensionState()
9798

9899
// Show a WarningRow when the user sends a message with a retired provider.
@@ -1527,7 +1528,8 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
15271528
return (
15281529
<div
15291530
data-testid="chat-view"
1530-
className={isHidden ? "hidden" : "fixed top-0 left-0 right-0 bottom-0 flex flex-col overflow-hidden"}>
1531+
className={isHidden ? "hidden" : "fixed top-0 left-0 right-0 bottom-0 flex flex-col overflow-hidden"}
1532+
style={{ fontSize: `calc(1em * ${chatFontSizeMultiplier ?? 1})` }}>
15311533
{telemetrySetting === "unset" && <TelemetryBanner />}
15321534
{(showAnnouncement || showAnnouncementModal) && (
15331535
<Announcement

‎webview-ui/src/components/settings/SettingsView.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
200200
openRouterImageGenerationSelectedModel,
201201
reasoningBlockCollapsed,
202202
enterBehavior,
203+
chatFontSizeMultiplier,
203204
includeCurrentTime,
204205
includeCurrentCost,
205206
maxGitStatusFiles,
@@ -892,6 +893,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
892893
<UISettings
893894
reasoningBlockCollapsed={reasoningBlockCollapsed ?? true}
894895
enterBehavior={enterBehavior ?? "send"}
896+
chatFontSizeMultiplier={chatFontSizeMultiplier ?? 1}
895897
setCachedStateField={setCachedStateField}
896898
/>
897899
)}

‎webview-ui/src/components/settings/UISettings.tsx‎

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { HTMLAttributes, useMemo } from "react"
1+
import { HTMLAttributes, useMemo, useState, useCallback, useEffect } from "react"
22
import { useAppTranslation } from "@/i18n/TranslationContext"
33
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
4+
import { RotateCcw } from "lucide-react"
45
import { telemetryClient } from "@/utils/TelemetryClient"
56

67
import { SetCachedStateField } from "./types"
@@ -12,17 +13,27 @@ import { ExtensionStateContextType } from "@/context/ExtensionStateContext"
1213
interface UISettingsProps extends HTMLAttributes<HTMLDivElement> {
1314
reasoningBlockCollapsed: boolean
1415
enterBehavior: "send" | "newline"
16+
chatFontSizeMultiplier: number
1517
setCachedStateField: SetCachedStateField<keyof ExtensionStateContextType>
1618
}
1719

1820
export const UISettings = ({
1921
reasoningBlockCollapsed,
2022
enterBehavior,
23+
chatFontSizeMultiplier,
2124
setCachedStateField,
2225
...props
2326
}: UISettingsProps) => {
2427
const { t } = useAppTranslation()
2528

29+
// Local state for the input value to allow typing freely
30+
const [localMultiplier, setLocalMultiplier] = useState(chatFontSizeMultiplier.toString())
31+
32+
// Sync local state when prop changes (e.g., from commands)
33+
useEffect(() => {
34+
setLocalMultiplier(chatFontSizeMultiplier.toString())
35+
}, [chatFontSizeMultiplier])
36+
2637
// Detect platform for dynamic modifier key display
2738
const primaryMod = useMemo(() => {
2839
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0
@@ -48,6 +59,45 @@ export const UISettings = ({
4859
})
4960
}
5061

62+
const handleFontSizeMultiplierChange = useCallback(
63+
(value: string) => {
64+
setLocalMultiplier(value)
65+
66+
// Parse and validate the value
67+
const numValue = parseFloat(value)
68+
if (!isNaN(numValue)) {
69+
// Clamp the value between 0.5 and 2
70+
const clampedValue = Math.max(0.5, Math.min(2, numValue))
71+
setCachedStateField("chatFontSizeMultiplier", clampedValue)
72+
73+
// Track telemetry event
74+
telemetryClient.capture("ui_settings_chat_font_size_changed", {
75+
multiplier: clampedValue,
76+
})
77+
}
78+
},
79+
[setCachedStateField],
80+
)
81+
82+
const handleFontSizeMultiplierBlur = useCallback(() => {
83+
// On blur, ensure the display value matches the clamped value
84+
const numValue = parseFloat(localMultiplier)
85+
if (isNaN(numValue)) {
86+
setLocalMultiplier(chatFontSizeMultiplier.toString())
87+
} else {
88+
const clampedValue = Math.max(0.5, Math.min(2, numValue))
89+
setLocalMultiplier(clampedValue.toString())
90+
}
91+
}, [localMultiplier, chatFontSizeMultiplier])
92+
93+
const handleResetFontSize = useCallback(() => {
94+
setCachedStateField("chatFontSizeMultiplier", 1)
95+
setLocalMultiplier("1")
96+
97+
// Track telemetry event
98+
telemetryClient.capture("ui_settings_chat_font_size_reset", {})
99+
}, [setCachedStateField])
100+
51101
return (
52102
<div {...props}>
53103
<SectionHeader>{t("settings:sections.ui")}</SectionHeader>
@@ -91,6 +141,43 @@ export const UISettings = ({
91141
</div>
92142
</div>
93143
</SearchableSetting>
144+
145+
{/* Chat Font Size Multiplier Setting */}
146+
<SearchableSetting
147+
settingId="ui-chat-font-size"
148+
section="ui"
149+
label={t("settings:ui.chatFontSizeMultiplier.label")}>
150+
<div className="flex flex-col gap-1">
151+
<label className="font-medium" htmlFor="chat-font-size-input">
152+
{t("settings:ui.chatFontSizeMultiplier.label")}
153+
</label>
154+
<div className="flex items-center gap-2">
155+
<input
156+
id="chat-font-size-input"
157+
type="number"
158+
min="0.5"
159+
max="2"
160+
step="0.1"
161+
value={localMultiplier}
162+
onChange={(e) => handleFontSizeMultiplierChange(e.target.value)}
163+
onBlur={handleFontSizeMultiplierBlur}
164+
className="w-20 px-2 py-1 bg-vscode-input-background text-vscode-input-foreground border border-vscode-input-border rounded"
165+
data-testid="chat-font-size-input"
166+
/>
167+
<button
168+
onClick={handleResetFontSize}
169+
className="flex items-center gap-1 px-2 py-1 text-sm bg-vscode-button-secondaryBackground text-vscode-button-secondaryForeground hover:bg-vscode-button-secondaryHoverBackground rounded"
170+
title={t("settings:ui.chatFontSizeMultiplier.reset")}
171+
data-testid="chat-font-size-reset-button">
172+
<RotateCcw className="w-3 h-3" />
173+
{t("settings:ui.chatFontSizeMultiplier.reset")}
174+
</button>
175+
</div>
176+
<div className="text-vscode-descriptionForeground text-sm mt-1">
177+
{t("settings:ui.chatFontSizeMultiplier.description")}
178+
</div>
179+
</div>
180+
</SearchableSetting>
94181
</div>
95182
</Section>
96183
</div>

0 commit comments

Comments
 (0)