Fixes #4817. CharMap: handle zero-width ModifierSymbol runes without throwing#4818
Merged
tig merged 3 commits intov2_developfrom Mar 10, 2026
Merged
Conversation
… (e.g. U+1F3FB) Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CharMap InvalidOperationException for ModifierSymbol
Fixes #issue. CharMap: handle zero-width ModifierSymbol runes without throwing
Mar 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes CharMap rendering crashes when encountering zero-width UnicodeCategory.ModifierSymbol runes (e.g., emoji skin tone modifiers), and makes the renderer resilient to any future zero-width categories by using a placeholder instead of throwing.
Changes:
- Add explicit rendering for
UnicodeCategory.ModifierSymbolinCharMap.RenderGrapheme, showing a highlighted"M"placeholder when the rune’s column width is 0. - Replace the zero-width
default-caseInvalidOperationExceptionwith a highlighted"?"fallback to prevent crashes. - Add a unit test that draws CharMap at U+1F3FB and asserts no exception is thrown.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Terminal.Gui/Views/CharMap/CharMap.cs | Adds ModifierSymbol handling and replaces zero-width default-case throw with a safe placeholder render. |
| Tests/UnitTestsParallelizable/Views/CharMapTests.cs | Adds a draw regression test for a zero-width ModifierSymbol code point (U+1F3FB). |
Collaborator
|
Cancelled after 60 minutes is a very long time. Are you sure it's running in degraded mode on Windows? |
Collaborator
|
The Link PR has a bug. I've fixed it in the kitty PR. |
This was referenced May 1, 2026
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.
Fixes #4817
CharMap.RenderGraphemethrewInvalidOperationExceptionforUnicodeCategory.ModifierSymbolcharacters with column width 0 (e.g. emoji skin tone modifiers U+1F3FB–U+1F3FF), which are designed to combine with a preceding base glyph and cannot render standalone.Changes
CharMap.cs—RenderGrapheme: Addcase UnicodeCategory.ModifierSymbol:rendering a highlighted"M"placeholder whenwidth == 0(consistent withFormat→"F"), or the grapheme normally whenwidth > 0CharMap.cs—defaultbranch: Replacethrow new InvalidOperationExceptionwith a highlighted"?"fallback, making the renderer resilient to any future zero-width Unicode categories not yet explicitly handledCharMapTests.cs: AddDraw_ModifierSymbol_CodePoint_Does_Not_Throw— draws aCharMapat U+1F3FB and asserts no exceptionPull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.