Skip to content

Draw small pictures like emoji inside their line - #158

Closed
HarryCordewener wants to merge 1 commit into
mainfrom
claude/project-thread-0435kg
Closed

HarryCordewener wants to merge 1 commit into
mainfrom
claude/project-thread-0435kg

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Requested by Grave · project thread

Problem

A custom emoji relayed from Discord reaches SharpMUTerm as an MXP ˋ<IMAGE … W=22>ˋ in the middle of a say. SharpMUTerm drew every picture that had no server-reserved cells on rows under its line and took the label off the line, so the say read Ada says, "" with the emoji on the next rows.

The server's output is correct (one IMAGE tag where the emoji is, sized 22 px); the line break came from the client's placement rule.

Change

  • A picture whose size hint is word-sized (height ≤ 32 px or 1 row; with no height, width ≤ 32 px or 2 cells) becomes a one-row slot over its label, loaded with one row (SharpMUTermApp.IsGlyphSized).
  • PictureSlots.Fitted: such a picture is not padded to its label's width, so the text after it closes up.
  • Pictures with no hints, or larger hints (Discord stickers at 160 px, attachments), still go under their line.

Tests

MxpImageTests: a 22 px picture in Ada says, "Hi … there" renders as Ada says, "Hi ▀▀ there" with no extra rows and keeps its link; the size rule is checked for 22, 32, 33, 160 px and with a height hint.


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Small, word-sized pictures now appear inline between surrounding words, preserving the line layout and any associated link. Larger pictures continue to appear below their line.
  • Documentation
    • Clarified how picture size affects whether an image appears inline or beneath its line.

A custom emoji relayed from Discord arrives as an MXP IMAGE with W=22 in the
middle of a say. Every picture that was not given reserved cells went under
its line, so the say read 'says, ""' with the emoji on the rows below.

A picture whose size hint is at most 32 px (or one row tall, or two cells
wide with no height) is now a one-row slot over its label, drawn at its own
width so the text after it closes up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7WAdxrhzJfxpEMBp3e
@HarryCordewener HarryCordewener self-assigned this Nov 30, 2026
@HarryCordewener
HarryCordewener marked this pull request as ready for review November 30, 2026 23:36
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

Glyph-sized inline pictures now render in a one-row slot at the label position when their size hints meet the specified limits. Other pictures retain their existing placement behavior. Tests cover the size classification, inline position, link, and line layout.

Changes

Inline Picture Rendering

Layer / File(s) Summary
Fitted picture slots
src/SharpMUTerm.Tui/PictureSlots.cs
PictureSlots accepts fitted picture IDs. It draws those pictures without padding them to the slot width.
Glyph-sized picture placement
src/SharpMUTerm.Tui/SharpMUTermApp.cs, tests/SharpMUTerm.Tui.Tests/MxpImageTests.cs, CHANGELOG.md, CLAUDE.md
IsGlyphSized classifies requests by height when specified, or by width when height is unspecified. AppendSessionLine reserves a one-row slot at the label position for qualifying pictures when the label does not overlap existing slots. Tests check classification and inline rendering. The changelog and CLAUDE.md document the placement rules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: claude

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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