diff --git a/clients/terminal/tui/renderers/markdown_content.py b/clients/terminal/tui/renderers/markdown_content.py index 32f5af4..d5d9bf3 100644 --- a/clients/terminal/tui/renderers/markdown_content.py +++ b/clients/terminal/tui/renderers/markdown_content.py @@ -27,8 +27,16 @@ def __rich_console__(self, console: Console, options: ConsoleOptions) -> RenderResult: theme = get_active_theme() + # Render at the *available* width (options.max_width), not the physical + # console width. Textual passes a console whose .width is the terminal + # width (e.g. 80), but the panel the markdown lives in is narrower — + # options.max_width holds the real available columns (panel inner width + # minus borders/padding). Using console.width here made rich wrap to the + # terminal width while the visible area was narrower, so the right side + # of every long line vanished off the panel's right edge. Fall back to + # console.width only if max_width is unset. themed_console = Console( - width=console.width, + width=options.max_width or console.width, color_system=console.color_system, theme=RichTheme(theme.rich_theme_styles()), force_terminal=True,