Skip to content

Keep two equal exits, links or pictures side by side apart (MarkupString 2.29.1) - #131

Merged
HarryCordewener merged 7 commits into
mainfrom
claude/project-thread-ii9qqf
Nov 12, 2026
Merged

HarryCordewener merged 7 commits into
mainfrom
claude/project-thread-ii9qqf

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Requested by Grave

Problem

Two MXP elements that look the same and sit next to each other were read as one. <Ex>north</Ex><Ex>south</Ex> with FLAG=RoomExit gave one exit, northsouth, and two <SEND>s to the same command gave one link over both words. The decoder merged them, and so did MarkupLineParser's own span merge.

Fix

  • MarkupString 2.29.1 (Keep equal elements side by side apart (ElementMarkup) MarkupString#99) gives each link, menu, picture, variable and flagged element its own ElementMarkup.
  • MarkupLineParser.Add now joins a span to the one before it only when both are in the same element, the innermost one. Text in one element still joins across a style change.
  • Flag tracking already compared flags by reference, so it needed no change. The runs are now separate, so two exits raise two Flagged events.

Tests

MxpDefinitionTests:

  • TwoEqualFlaggedElementsSideBySideAreTwo
  • TwoEqualLinksSideBySideAreTwoSpans (SEND, A, SEND menu)
  • OneLinkStaysOneSpanAcrossALookAlikeBoundary

Run locally against 2.29.1 from nuget.org:

  • Core: 1729/1730. The failure is AReadOnlyCacheDirectory_DegradesToMemoryOnly, which fails as root on main too.
  • Client, Tui and Web pass. I ran those three against a local 2.29.0 pack of the same decoder code; 2.29.1 only adds an opt-in UrlPolicy check.

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Adjacent exits, links, and images that look identical are now preserved as separate items instead of being combined. Links to the same destination and adjacent MXP exits are also kept distinct.

AnsiParser, MxpParser, PuebloParser and ILineParser are replaced by
MarkupLineParser, one MarkupString Decoder per session (WithVt, WithMxp,
WithPueblo) folded into the existing StyledLine model. The old parser test
suites are kept and run against the adapter as the capability inventory;
the gaps they found were fixed in MarkupString 2.27.0.

Behaviour changes the tests now record: &nbsp; is U+00A0, erase-line
erases, Pueblo <img> shows its label, VERSION values are quoted, a picture
that would cover text goes inline, and a forged non-web link is text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7WA8C5XG14TAWB6b9V
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7WA8C5XG14TAWB6b9V
A blank line inside an open flagged element has no flagged run, so the
line end emitted what had been read and the rest came as a second event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7WA8C5XG14TAWB6b9V
Adds the CAN and SUB cases to TempSecure_IsSpentByAnyEscapeThatIsNotALineTag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7WA8C5XG14TAWB6b9V
MarkupString 2.29.1 marks each link, picture, variable and flagged element
with its own ElementMarkup. The span merge now also requires the same
element, so two look-alike links next to each other stay two spans, and two
flagged exits raise two flag events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7WA8C5XG14TAWB6b9V
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 49 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 64 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: e37892bd-1068-486e-9038-20e7011b0bf5
Commits

Reviewing files that changed from the base of the PR and between 19bd7bb and 07999fc.

Files selected for processing: 2

  • src/SharpMUTerm.Core/Text/StyledText.cs
  • tests/SharpMUTerm.Core.Tests/Text/StyledTextTests.cs

No actionable comments were generated in the recent review.

Walkthrough

MarkupLineParser now preserves element identity when folding spans. Adjacent spans merge only when their elements, styles, and interactions match. Tests cover adjacent MXP exits and links, and a link across an empty inline-style tag. The changelog and centrally managed MarkupString package versions are updated.

Changes

Markup span folding

Layer / File(s) Summary
Element-aware span folding
src/SharpMUTerm.Core/Text/MarkupLineParser.cs, tests/SharpMUTerm.Core.Tests/Protocols/MxpDefinitionTests.cs, Directory.Packages.props, CHANGELOG.md
Style returns the selected element markup, and Fold passes it to Add. Adjacent spans merge only when their elements, styles, and interactions match. Tests cover adjacent MXP exits and links, and a link across an empty inline-style tag. MarkupString package versions change from 2.28.1 to 2.29.1. The changelog records the separate-item behavior.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • SharpMUSH/SharpMUTerm#118: Introduced MarkupLineParser and the centrally managed MarkupString packages that this change updates.

Suggested reviewers: claude

Merge Risk: Low · previous review 19bd7

Adjacent identical exits or links are now kept separate. If the opt-in colour-stripping setting is on and the same line contains colour, they can still merge into one, as they did before this change. Merging is safe, with the known residual gap in that narrow case.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main parser change: adjacent equal exits, links, or pictures remain separate. The package version is relevant context.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 2 files. (2 skipped: 2 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 84ea6232-d6af-4064-82e2-ccb2c001d097
Commits

Reviewing files that changed from the base of the PR and between 2f86e2f and 19bd7bb.

Files selected for processing: 4

  • CHANGELOG.md
  • Directory.Packages.props
  • src/SharpMUTerm.Core/Text/MarkupLineParser.cs
  • tests/SharpMUTerm.Core.Tests/Protocols/MxpDefinitionTests.cs

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@HarryCordewener
HarryCordewener marked this pull request as ready for review November 11, 2026 05:24
StripColour joined spans that stripping made equal, and also joined spans
that were already equal, which the parser keeps apart only when they are two
elements. Join only what stripping made equal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7WA8C5XG14TAWB6b9V
@HarryCordewener
HarryCordewener merged commit c2d7bed into main Nov 12, 2026
4 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