Skip to content

fix(tui): preserve wrapped prose beside URLs#21760

Merged
fcoury-oai merged 5 commits into
mainfrom
fcoury/fix-wrapping
May 9, 2026
Merged

fix(tui): preserve wrapped prose beside URLs#21760
fcoury-oai merged 5 commits into
mainfrom
fcoury/fix-wrapping

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

@fcoury-oai fcoury-oai commented May 8, 2026

Why

Mixed prose lines that contained URLs started taking the URL-preserving wrapping path, but that path could split ordinary words mid-token. A follow-up issue remained in scrollback insertion: when already-rendered indented rows were wrapped again, continuation rows could lose their margin and fall back to terminal hard wrapping. Together those bugs made normal Markdown output look broken around links, lists, blockquotes, and indented content.

Separately, the local argument-comment lint wrappers failed under environments that set PYTHONSAFEPATH=1, because Python no longer adds the script directory to sys.path automatically. That prevented the lint from reaching Rust callsites at all.

CleanShot 2026-05-09 at 11 51 38

What Changed

  • Preserve URL tokens without turning every neighboring prose word into a character-level split point.
  • Add a mixed URL/prose wrapper that keeps ordinary words whole, preserves leading whitespace, and re-splits long non-URL tokens against the actual width available on continuation rows.
  • Reuse a rendered history row's leading whitespace as the continuation indent when scrollback insertion has to pre-wrap it again.
  • Add regression coverage for markdown wrapping, history-cell rendering, scrollback continuation margins, leading-indent width accounting, and continuation-row re-splitting.
  • Make both argument-comment lint entrypoints explicitly add their own directory to sys.path, so sibling imports still work when PYTHONSAFEPATH=1.

How to Test

  1. Start Codex and render a long Markdown response that mixes prose with inline links, blockquotes, lists, and indented code-like text.
  2. Confirm that ordinary words next to links stay whole instead of breaking mid-word.
  3. Resize or replay the transcript and confirm wrapped continuation rows keep their expected left margin for blockquotes, lists, and indented content.
  4. Run the source argument-comment lint from a shell with PYTHONSAFEPATH=1 and confirm it starts normally instead of failing to import wrapper_common.

Targeted tests:

  • cargo test -p codex-tui mixed_line --lib
  • cargo test -p codex-tui preserves_prefix_on_wrapped_rows --lib
  • cargo test -p codex-tui agent_markdown_cell_does_not_split_words_after_inline_markdown --lib
  • cargo test -p codex-tui mixed_url_markdown_wraps_prose_without_splitting_words_snapshot --lib
  • python3 tools/argument-comment-lint/test_wrapper_common.py
  • just argument-comment-lint-from-source -p codex-tui -- --lib

Notes:

  • cargo test -p codex-tui currently reaches the new tests successfully, then still aborts in the pre-existing tests::fork_last_filters_latest_session_by_cwd_unless_show_all stack-overflow failure.

fcoury-oai added a commit that referenced this pull request May 9, 2026
fcoury-oai added a commit that referenced this pull request May 9, 2026
fcoury-oai added a commit that referenced this pull request May 9, 2026
@fcoury-oai fcoury-oai force-pushed the fcoury/fix-wrapping branch from 1006db5 to c126e01 Compare May 9, 2026 15:43
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Code looks good. I also build and verified the existing buggy behavior using some test prompts and confirmed that the bug is fixed with this change.

@fcoury-oai fcoury-oai merged commit f27cf9d into main May 9, 2026
27 checks passed
@fcoury-oai fcoury-oai deleted the fcoury/fix-wrapping branch May 9, 2026 16:58
@github-actions github-actions Bot locked and limited conversation to collaborators May 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants