Skip to content

fix(tui): preserve characters when wrapping markdown lists#2380

Open
bdragan wants to merge 4 commits into
MoonshotAI:mainfrom
bdragan:fix/markdown-list-wrap-rendering
Open

fix(tui): preserve characters when wrapping markdown lists#2380
bdragan wants to merge 4 commits into
MoonshotAI:mainfrom
bdragan:fix/markdown-list-wrap-rendering

Conversation

@bdragan
Copy link
Copy Markdown

@bdragan bdragan commented May 27, 2026

Resolve #2379

Description

Fix markdown list wrapping in the shell TUI.

Before this change, wrapped list items could render incorrectly in two ways:

  • characters at the right edge of a wrapped line could be dropped
  • words could wrap in the middle instead of at word boundaries

Example before:
image

Notice: thro(ug)h, Pro(to)col, compac(ti)on

The root cause was that list item content was effectively wrapped without fully accounting for the bullet/number prefix width. This change makes list-item wrapping prefix-aware for the common single-paragraph case, preserves inline Text styling while splitting wrapped lines, and keeps the existing fallback path for more complex list items.

Now:
image

It also adds regression coverage for:

  • wrapped markdown bullet lists preserving full text
  • the same behavior when markdown is rendered inside the outer assistant bullet layout
  • styled list content continuing to render with inline formatting

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open in Devin Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7215fc6a93

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/kimi_cli/utils/rich/markdown.py Outdated
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d49b1f2916

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/kimi_cli/utils/rich/markdown.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2582f8257

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/kimi_cli/utils/rich/markdown.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown list items in TUI drop characters and split words when wrapped

1 participant