Repository navigation
windows: combine UTF-16 surrogate pairs for non-BMP input - #41
Closed
NeonMedusa wants to merge 1 commit into
Closed
NeonMedusa wants to merge 1 commit into
NeonMedusa wants to merge 1 commit into
Conversation
CJK and emoji occupy two terminal columns, but render advanced one column per code point. The next glyph was then written into the trailing cell of a wide character, and the buffer cleared the pair - wide characters never appeared in the field (the value itself was correct, only the rendering was wrong). Cursor column, scroll window and glyph placement now all count display columns via codepointWidth, matching the buffer's cell model. Covered by tests for wide-character layout, cursor-on-wide-char, column-based scrolling and placeholder clamping.
Contributor
Author
|
Closing this in favour of #42, which covers the same input fix together with the related widget layout fixes I found while testing. Sorry for the noise - nothing was wrong with this PR, it's just consolidated into one wide-character change now. |
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 #40.
Non-BMP characters (emoji) arrived as two KEY_EVENTs and both surrogate halves were rejected by the
unicode_char < 0xD800guard, so the input was silently dropped. Now the leading surrogate is buffered and combined with the trailing one, matching conhost's_leadingSurrogatebehavior.Two details worth noting:
.charevent.combineSurrogatesandresolveSurrogateare plain functions with unit tests, so the state machine is covered on non-Windows CI too (72 -> 74 tests).Verified on Windows Terminal / ConPTY: emoji picker (Win+.) and pasting emoji now produce a
.charevent; BMP input is unaffected.zig build testandzig build examplespass, plus a-target x86_64-linux-gnucompile check.