fix(card): show ───── dividers between options in kb-mode box-frame path#136
Merged
Conversation
The #134 archive-style option dividers only ran in _render_card's frameless branch. But real AskUserQuestion panes frame each option's preview in box-drawing glyphs (│ ┌ ├), so _BOX_FRAME_RE always matched and rendering took the code-fence branch — which emitted the sanitized body as one monospace block with NO dividers. The feature never fired for the panes users actually see (the frameless tests passed because they call _format_kb_prompt directly or feed frameless prompts). Splice literal ───── rule lines between numbered options inside the fenced path too (new _rule_between_options). Inside the fence they render as plain monospace dividers — same visible separation without dropping the fence, which still prevents telegramify's blockquote-collapse ("✂ N lines hidden") and MarkdownV2 escaping on the long boxed region. Each option keeps its trailing preview lines; existing source rules are absorbed so separators never double up. Updates test_box_frame_path_unaffected -> test_box_frame_path_no_hard_breaks (hard-break trick still excluded; dividers now expected) and adds test_options_separated_by_divider. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#133/#134 added archive-style
─────dividers between numbered options in kb-mode — but they never appear for real prompts. Root cause:_render_cardgates the divider logic behind the box-frame check.Claude Code frames each option's
previewin box-drawing glyphs (│ ┌ ├), so_BOX_FRAME_RE.search(raw)is always true → rendering takes the code-fence branch, which emitted the de-framed body as one monospace block with no dividers._format_kb_prompt(the whole #134 feature) only ran for frameless panes, which real panes never are.The #133/#134 tests stayed green because they call
_format_kb_promptdirectly or feed frameless prompts, and one integration test (test_box_frame_path_unaffected) actively asserted the divider was absent in the fenced path. It's not a Telegram/parser issue — the same─────renders fine in/archive(handlers/archive.py).Fix
Splice literal
─────rule lines between numbered options inside the fenced path too (new_rule_between_options). Inside the fence they render as plain monospace dividers — the same visible separation, without dropping the fence.Keeping the fence matters: it's what prevents telegramify's blockquote-collapse (the "✂ N lines hidden" artifact) and MarkdownV2 escaping on the long boxed region. Dropping it to reuse the frameless markup dividers would regress that. So the dividers go in the fence instead.
Each option keeps its trailing preview/description lines (they ride with the option until the next numbered row); pre-existing source rule lines are absorbed so separators never double up.
Tests
test_box_frame_path_unaffected→test_box_frame_path_no_hard_breaks: still asserts the CommonMark hard-break trick (\n) stays out of the fence, but no longer forbids dividers (which are now intended).test_options_separated_by_divider: a realBOXED_PROMPTrenders exactly two─────rules — before options 2 and 3, none before option 1 or splitting option 1 from its preview.Full suite green (737 passed), pyright (strict,
src/ccbot) + ruff clean.🤖 Generated with Claude Code