diff --git a/app/lib/features/chat/ui/transcript/chat_markdown_view.dart b/app/lib/features/chat/ui/transcript/chat_markdown_view.dart index 0b755ccc..fe68720c 100644 --- a/app/lib/features/chat/ui/transcript/chat_markdown_view.dart +++ b/app/lib/features/chat/ui/transcript/chat_markdown_view.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/semantics.dart'; import '../../../../ui/layout/wheel_scroll_forwarding.dart'; +import '../../../../ui/text/monospace.dart'; import '../sessions/chat_adaptive.dart'; import 'chat_link_launcher.dart'; import 'chat_link_spans.dart'; @@ -209,7 +210,12 @@ class _ChatMarkdownViewState extends State { decoration: BoxDecoration(color: _codeFill(context, cupertino)), child: Padding( padding: const EdgeInsets.all(12), - child: HorizontalScrollView(child: Text(code)), + child: HorizontalScrollView( + child: Text( + code, + style: const TextStyle(fontFamily: appMonospaceFamily), + ), + ), ), ), ], @@ -262,9 +268,12 @@ class _ChatMarkdownViewState extends State { MarkdownPlain(text: final text) => TextSpan(text: text), MarkdownInlineCode(text: final text) => TextSpan( text: text, - // The same host-theme surface as a fenced block marks the run as - // code without a font, size or literal colour override. - style: TextStyle(backgroundColor: _codeFill(context, cupertino)), + // The same host-theme surface and monospace family as a fenced + // block mark the run as code; the size stays the surrounding text's. + style: TextStyle( + fontFamily: appMonospaceFamily, + backgroundColor: _codeFill(context, cupertino), + ), ), MarkdownStrong(spans: final inner) => TextSpan( style: const TextStyle(fontWeight: FontWeight.bold), diff --git a/app/test/features/chat/ui/transcript/chat_markdown_presentation_test.dart b/app/test/features/chat/ui/transcript/chat_markdown_presentation_test.dart index 6bb18e29..b2fefcc2 100644 --- a/app/test/features/chat/ui/transcript/chat_markdown_presentation_test.dart +++ b/app/test/features/chat/ui/transcript/chat_markdown_presentation_test.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/semantics.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/chat/ui/transcript/chat_markdown_view.dart'; +import 'package:pipelines_app/ui/text/monospace.dart'; import 'chat_markdown_test_support.dart'; @@ -126,7 +127,7 @@ void main() { expect(code.style?.backgroundColor, fill, reason: '$cupertino'); expect(plain.style?.backgroundColor, isNull, reason: '$cupertino'); expect(code.style?.fontSize, isNull, reason: '$cupertino'); - expect(code.style?.fontFamily, isNull, reason: '$cupertino'); + expect(code.style?.fontFamily, appMonospaceFamily, reason: '$cupertino'); } });