Skip to content

Add a bell: a point in the text that asks the client for attention - #14

Merged
HarryCordewener merged 1 commit into
mainfrom
feature/bell-markup
Sep 22, 2026
Merged

HarryCordewener merged 1 commit into
mainfrom
feature/bell-markup

Conversation

@HarryCordewener

Copy link
Copy Markdown
Member

MarkupText.Bell() marks a point in the text where the client is asked to get someone's attention.

var line = MarkupText.Concat(MarkupText.Plain("Someone pages you"), MarkupText.Bell());

line.Render(MarkupFormat.Ansi);    // Someone pages you + U+0007
line.Render(MarkupFormat.Pueblo);  // the same
line.Render(MarkupFormat.Mxp);     // the same
line.Render(MarkupFormat.Html);    // Someone pages you<span class="ms-bell" role="alert"></span>
line.Render(MarkupFormat.Plain);   // Someone pages you

How it is carried

A bell is an event at a position, not a property of a span, and the model has no zero-length run — Wrap returns Empty for empty text, and every operation assumes a run covers real characters. So a bell rides on the single U+0007 it marks:

  • that character is a real position, so slicing, concatenation and padding carry it like any other text;
  • it measures zero display cells (DisplayWidth already gives every control zero), so a column holding one is not a cell narrower than its neighbours;
  • the emitter writes the character rather than letting the body through, because the Html, Pueblo and MXP encodings drop control characters from text — which is also why a bell is the only way a control character reaches rendered output.

What the HTML element means — a sound, a flash, a title change, nothing — is the page's to decide, as with the ms-cmd-link anchor.

Layout

  • BellMarkup and MarkupText.Bell() are in the core package, so the type and its serialization are format-neutral; the serializer handles it beside NeutralMarkup, with no codec needed.
  • The emitters are in MarkupString.Ansi, which already owns the ms-* classes and the HTML emitter for AnsiMarkup.

Tests

BellTests (6): written for every client that reads one; a control character in ordinary text still dropped; nothing left behind in Plain and BBCode; measures zero; survives Substring and Pad; round-trips through the serializer. 611/611 pass in Release.

Suggested release: 2.3.0.

🤖 Generated with Claude Code

MarkupText.Bell() marks a position rather than a span of text. It renders as
U+0007 for a terminal, Pueblo or MXP client and as an empty ms-bell element for
HTML, where the page decides what a bell means; Plain and BBCode leave nothing
behind.

It rides on the single U+0007 it marks. That character is a real position in the
text and measures zero display cells, so it survives slicing, concatenation and
padding as a point in the string without moving anything laid out around it —
and, because the encodings drop control characters from ordinary text, a bell is
the only way one reaches rendered output.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Warning

Review paused — included plan limit reached

Keep your review moving with free on-demand reviews.

  • Run this review for free

On-demand reviews are free for the next 20 days.

  • 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.

Promotion and pricing details

On-demand reviews are free for the next 20 days. After that, they cost $0.25 per reviewed file.

Review limit details

Or wait 35 minutes for your next included review.

Check out review usage here.

Limit details: You’ve used the included review currently available. Your 63 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

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: da493ff5-5d73-41d6-958d-7f4aedf433d0

📥 Commits

Reviewing files that changed from the base of the PR and between 4d85fb4 and 96d2357.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • MarkupString.Ansi/AnsiRegistration.cs
  • MarkupString.Ansi/Emitters/BellEmitter.cs
  • MarkupString.Ansi/PublicAPI.Unshipped.txt
  • MarkupString.Tests/BellTests.cs
  • MarkupString/BellMarkup.cs
  • MarkupString/MarkupText.cs
  • MarkupString/MarkupTextSerializer.cs
  • MarkupString/PublicAPI.Unshipped.txt
  • docs/formats.md

Comment @coderabbitai help to get the list of available commands.

@HarryCordewener
HarryCordewener merged commit 9965a5b into main Sep 22, 2026
7 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.

1 participant