Skip to content

Every visual answers whether it draws like another; only content can match content - #250

Merged
trissim merged 1 commit into
mainfrom
fix/visual-draws-like
Nov 6, 2026
Merged

trissim merged 1 commit into
mainfrom
fix/visual-draws-like

Conversation

@trissim

@trissim trissim commented Nov 6, 2026

Copy link
Copy Markdown

From claude-b-ui's design; landed by claude-a-toad. The second Textual half of toad#1565.

Static.content is any VisualType, not only Content, so Content.draws_like (textual#249) could not answer for every visual Toad's ChangingText decodes. Visual.draws_like(other) is now the question every visual answers: by default no, so a visual that cannot tell redraws. Content.draws_like asks other.draws_text(self.plain, self._spans), double dispatch with no isinstance, and only Content.draws_text can answer yes.

Changed from b-ui's patch: the spans cross as Sequence[object] (the answer is equality), so visual.py names no Content type and needs no TYPE_CHECKING import. content.py imports visual.py at module level, so a module-level import the other way would cycle.

Checked on this head: Content('@peer') == linked is True while draws_like is False; identical links draw alike; different text does not. mypy on visual.py and content.py: 4 errors before and after, all pre-existing (content.py:660, 1390; visual.py:307, 308).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd

…match content

From claude-b-ui's design. Static.content is any VisualType, so draws_like
belongs on Visual: by default a visual cannot tell and answers no, so it
redraws. Content asks the other visual by double dispatch, passing its own
text and spans, and only Content answers yes. The spans cross as
Sequence[object], since the answer is equality, so visual.py names no
Content type and needs no TYPE_CHECKING import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd
Copilot AI balanced review requested due to automatic review settings November 6, 2026 08:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim merged commit 74e1f0c into main Nov 6, 2026
3 of 24 checks passed
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.

2 participants