Repository navigation
Decode and draw server output with MarkupString - #31
Draft
HarryCordewener wants to merge 3 commits into
Draft
HarryCordewener wants to merge 3 commits into
HarryCordewener wants to merge 3 commits into
Conversation
Replace AnsiParser, MxpParserState and the segment types with MarkupString 2.26.1: a decoder per session (VT, MXP, Pueblo) turns each line into MarkupText, and OutputView draws SpanRenderer's spans. The client palette becomes an AnsiColors theme, and a Highlight trigger is a markup layer drawn by its own style contributor. Kept: every colour, link, image, entity and MXP line-mode behaviour the old parser had, the image source rules, and MXP <SUPPORT> answers that claim only what is drawn. Added: faint, italic, blink, conceal, strikethrough, overline, colon SGR, OSC 8 and MXP/Pueblo web links, MXP open tags, custom elements and SEND menus, and carriage-return overwrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rqqt7TnKiMidjBirFcUqtL
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rqqt7TnKiMidjBirFcUqtL
…d short-colour fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rqqt7TnKiMidjBirFcUqtL
Member
Author
|
Generated by Claude Code |
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.
Requested by Grave · project thread
Replaces
AnsiParser,MxpParserStateand the segment types (StyledSegment,TextStyle,AnsiColor,SegmentStyle,AnsiPalette) with MarkupString.Waiting on NuGet. This references MarkupString 2.27.0, which is tagged but not on NuGet yet. 2.26.0 lacks two things the old parser did (MXP
T=image directories, and a short38;2;…reading its leftover number as a background colour); SharpMUSH/MarkupString#81 (merged) fixes both and ships in 2.27.0. CI here cannot restore until 2.27.0 is published. The results below were run against a local pack of thev2.27.0tag.How it works now
OutputDecoder(Core): one MarkupStringDecoderper session, withWithVt().WithMxp().WithPueblo(). MXP and Pueblo are turned on by the same telnet events as before, and the decoder is reset when the connection drops. It answers nothing itself (ClientAnswers.None): TNC still answers MXP<SUPPORT>/<VERSION>, and there is no path for VT replies yet.ScrollbackLineholds aMarkupText.OutputViewdrawsSpanRenderer.Render(...)spans, cached per line.OutputDisplay: browser output with URL, command and menu interactions; no sound, no panes; prompt links become command links. Colours come fromOutputPalette, anAnsiColorssubclass that keeps the client's sixteen colours, with--pho/--outbgas the inverse defaults.TriggerHighlightMarkup, drawn by a style contributor that runs after the ANSI one, so it replaces the server's colour as before.TriggerEngine.Applytakes the decoded lines, not the raw string (it no longer decodes itself). Rules still match the raw line.MxpTagsnow claims the tags the decoder and view act on (open tags,A,SEND,IMAGEwitht/w/h, custom elements). It still does not claim sound, frames orsend.prompt.Capabilities before, and where each is checked now
OutputRenderingTests.AttributesAreDrawn/AttributesTurnOff/InverseSwaps…StandardColoursAreTheClientsOwn,PaletteColoursUseTheClientPalettePaletteColours…,Truecolor…38;2;40colours nothingTruncatedTruecolorColoursNothing--outbg/--phoInverseSwapsColoursAgainstTheOutputDefaultsBoldIsNotBrightenedpadding:0 2pxOutputViewTests.BackgroundGetsPaddingOtherControlSequencesAreNotShown&literal without MXP/PuebloMarkupIsLiteralWithoutMxpOrPueblo,SessionMxpTestsSENDhref/hint on secure lines, shorthandSEND, ignored on open linesSendOnSecureLine…,ShorthandSend…,SendOnOpenLine…LockSecurePersists…,SecureLineModeEndsWithTheLine,LockedLine…ColourInsideALinkKeepsTheLink,OutputViewLinkTests.CommandLinkKeepsItsColour>inside quotesEntitiesAreDecoded,PuebloEntities…,LoneAndUnknown…,EntityInsideAnAttribute…,GreaterThanInsideAQuotedAttribute…a xch_cmd/xch_hintPuebloAnchorWithXchCmd…,PuebloCommandLinkIsAButtonIMAGEfname/url/T, Puebloimgsrc/alt, image insideSEND,data:imageTneeds 2.27.0), pluswidth/heightMxpImage…,PuebloImg…,ImageInsideASend…,OutputViewLinkTests.MxpImageIsNamedAfterItsFiledata:imageimages load; refused ones show nothingImageSource.Resolveat draw time)NonWebImageSourcesAreRefused,RefusedImageSourceShowsNothingImagesOffRendersTheTextInsteadTriggerEngineTests,TriggerHighlightReplacesTheServersColourSessionTests.SendAppendsLocalEchoMarkupStateIsDroppedWhenTheConnectionGoesDown,ResetForgetsProtocolsAndStyleNew: faint, italic, blink (
ms-blink, off under reduced motion), conceal, strikethrough, overline; OSC 8, MXP<A>and Pueblo<a href>web links (target=_blank,noopener noreferrer, unsafe schemes stay text); MXP open tags (B,I,U,S,H,COLOR,FONT,BR), custom<!ELEMENT>s, andSEND href="a|b"menus (the text sends the first command, a ▾ toggle lists them all).Behaviour that changes
These follow the terminal and protocol specs, and the decoder does them on purpose:
\rand\e[Koverwrite in place:x\ryshowsy,a\e[2Kbshowsb(wasab).38;2;300;0;128) leaves the colour unchanged instead of clamping.</xch_mudtext>or<img xch_mode=html>), which PennMUSH-style servers send afterPUEBLOCLIENT. Before that, tags are text..sc-link's accent colour. Before, an inline phosphor colour always covered it.Tests
Run with the .NET 10.0.114 SDK against a local pack of MarkupString
v2.27.0(3cf3199):SharpClient.Tests: 301 passed, 0 failedSharpClient.UI.Tests: 92 passed, 0 failedSharpClient.Data.Tests: 19 passed, 0 failedSharpClient.Core,.UI,.Web,.Databuild in Release with warnings as errors.Not run: the MAUI Android head (no Android SDK here; CI's
android-buildjob covers it), and the app itself in a browser. The view is covered only by bUnit, so the menu popup's placement still needs a look by eye.🤖 Generated with Claude Code
https://claude.ai/code/session_01Rqqt7TnKiMidjBirFcUqtL