fix(fonts): honour the monospace setting in context-free render helpers (T-472)
Eleven leaf sites rendered monospace text from top-level/static helpers that take no BuildContext, so they hard-coded clideMonoFamily and ignored the Settings → Appearance Monospace choice that the D-101 facade made live everywhere else. Thread the resolved family in from the nearest context-bearing caller: - claude tool bodies/results: a required `mono` field on _ConversationTurn + a `mono` arg on the shared toolInputBody chain; - markdown inline `code`/record/file-ref spans: carried on ClideMarkdownHooks, which build() already constructs from context and threads to every static; - search preview styles and welcome tips: a `mono` parameter on the helpers. No behaviour change when the setting is default; these surfaces now switch live with the rest. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -336,6 +336,7 @@ class _ConversationViewState extends State<ConversationView> {
|
||||
key: ValueKey('turn.${item.uuid}'),
|
||||
item: item,
|
||||
tokens: tokens,
|
||||
mono: ClideSettings.fonts.monoOf(context),
|
||||
collapseTools: true,
|
||||
toolUseOutcomes: widget.toolUseOutcomes,
|
||||
quietErrorToolUseIds: widget.quietErrorToolUseIds,
|
||||
@@ -547,6 +548,7 @@ class _ConversationTurn extends StatelessWidget {
|
||||
super.key,
|
||||
required this.item,
|
||||
required this.tokens,
|
||||
required this.mono,
|
||||
this.collapseTools = false,
|
||||
this.toolUseOutcomes = const <String, bool>{},
|
||||
this.quietErrorToolUseIds = const <String>{},
|
||||
@@ -560,6 +562,11 @@ class _ConversationTurn extends StatelessWidget {
|
||||
final ConversationItem item;
|
||||
final SurfaceTokens tokens;
|
||||
|
||||
/// The live monospace family (T-471/T-472), resolved from context by the
|
||||
/// parent and threaded in so the context-free tool-body/result helpers honour
|
||||
/// the Settings → Appearance choice.
|
||||
final String mono;
|
||||
|
||||
/// When true (top-level stream items), a tool use renders as its own
|
||||
/// collapser over a one-item list (T-305). When false (already inside a run /
|
||||
/// edit collapser), it renders the bare inner content card so collapsers
|
||||
@@ -788,6 +795,7 @@ class _ConversationTurn extends StatelessWidget {
|
||||
key: ValueKey('run.${r.uuid}'),
|
||||
item: r,
|
||||
tokens: tokens,
|
||||
mono: mono,
|
||||
toolUseOutcomes: toolUseOutcomes,
|
||||
quietErrorToolUseIds: quietErrorToolUseIds,
|
||||
toolUseById: toolUseById,
|
||||
@@ -948,7 +956,7 @@ class _ConversationTurn extends StatelessWidget {
|
||||
label: t.name,
|
||||
copyText: const JsonEncoder.withIndent(' ').convert(t.input),
|
||||
status: status,
|
||||
body: toolInputBody(tokens, t.name, t.input),
|
||||
body: toolInputBody(tokens, t.name, t.input, mono),
|
||||
extraSegments: segments,
|
||||
// Inside a collapser the surrounding padding is even on all sides
|
||||
// (T-305): a matching bottom margin is the canvas's bottom inset and the
|
||||
@@ -1005,7 +1013,7 @@ class _ConversationTurn extends StatelessWidget {
|
||||
collapsible: quiet || multiline,
|
||||
collapsedByDefault: quiet, // genuine errors stay expanded; a denial folds
|
||||
collapsedSummary: (quiet || multiline) ? _firstLine(t.content) : null,
|
||||
body: ClideText(t.content, fontSize: clideFontMeta, fontFamily: clideMonoFamily, color: quiet ? tokens.globalTextMuted : tokens.statusError),
|
||||
body: ClideText(t.content, fontSize: clideFontMeta, fontFamily: mono, color: quiet ? tokens.globalTextMuted : tokens.statusError),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1026,7 +1034,7 @@ class _ConversationTurn extends StatelessWidget {
|
||||
collapsedSummary: multiline ? _firstLine(t.content) : null,
|
||||
body: isOutputTool
|
||||
? ClideCodeBlock(source: t.content, language: 'text')
|
||||
: ClideText(t.content, fontSize: clideFontMeta, fontFamily: clideMonoFamily, color: tokens.globalForeground),
|
||||
: ClideText(t.content, fontSize: clideFontMeta, fontFamily: mono, color: tokens.globalForeground),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1089,6 +1097,7 @@ class _ActivityCard extends StatelessWidget {
|
||||
key: ValueKey('step.${item.uuid}'),
|
||||
item: item,
|
||||
tokens: tokens,
|
||||
mono: ClideSettings.fonts.monoOf(context),
|
||||
toolUseOutcomes: toolUseOutcomes,
|
||||
quietErrorToolUseIds: quietErrorToolUseIds,
|
||||
toolUseById: toolUseById,
|
||||
@@ -1154,6 +1163,7 @@ class _EditRunCard extends StatelessWidget {
|
||||
key: ValueKey('edit.${item.uuid}'),
|
||||
item: item,
|
||||
tokens: tokens,
|
||||
mono: ClideSettings.fonts.monoOf(context),
|
||||
toolUseOutcomes: toolUseOutcomes,
|
||||
quietErrorToolUseIds: quietErrorToolUseIds,
|
||||
toolUseById: toolUseById,
|
||||
|
||||
Reference in New Issue
Block a user