From 52c06b8759eed97b2335e1046b3d7c8e4ddafb81 Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Mon, 27 Apr 2026 13:40:46 -0700 Subject: [PATCH] Preserve TUI markdown list spacing after code blocks (#19706) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why Fixes #19702. The TUI markdown renderer could visually attach the next list marker to a fenced code block inside the previous list item, even when the source markdown included a blank line before the next item. That made block-heavy loose lists harder to read, while the desired behavior is still to keep simple lists compact. ## What changed - Track whether the current rendered list item contains a code block. - Preserve one blank separator before the following list marker only when the previous item contained a code block. - Add regression coverage for both paths: code-block list items keep the separator, and simple loose list items stay compact. ## Verification - `cargo test -p codex-tui markdown_render` I also manually verified that the bug exists before and is fixed after. ## Before Screenshot 2026-04-26 at 1 19 01 PM ## After Screenshot 2026-04-26 at 1 18 54 PM --- codex-rs/tui/src/markdown_render.rs | 23 ++++++++ codex-rs/tui/src/markdown_render_tests.rs | 52 +++++++++++++++++++ ...fter_code_block_keeps_blank_separator.snap | 9 ++++ 3 files changed, 84 insertions(+) create mode 100644 codex-rs/tui/src/snapshots/codex_tui__markdown_render__markdown_render_tests__list_item_after_code_block_keeps_blank_separator.snap diff --git a/codex-rs/tui/src/markdown_render.rs b/codex-rs/tui/src/markdown_render.rs index ae680f5db..3dfef1d9d 100644 --- a/codex-rs/tui/src/markdown_render.rs +++ b/codex-rs/tui/src/markdown_render.rs @@ -154,6 +154,8 @@ where inline_styles: Vec