Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove IsGlyphFullWidth from InputBuffer #17680

Merged
merged 3 commits into from
Aug 7, 2024
Merged

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Aug 7, 2024

In several places the old conhost codebase appears to assume that any
wide glyph is represented by two codepoints. This is probably an
artifact of the ASCII/DBCS split that conhost used to have.
When conhost got merged into a single UCS2-aware application,
this artifact was apparently never properly resolved.

To my knowledge there are at least two places where this assumption
exists: The clipboard code which translates non-wide non-ascii
characters to Alt-numpad sequences, and this code. Both are wrong.
This is because in a Unicode-context there's no correlation between
the number of codepoints and the width of the glyph, even with UCS2.

In a post-UCS2-world the correct check is for surrogate pairs,
as they must be avoided for the same reason DBCS were avoided.

One could consider this a breaking change of the API,
as this can now result in repeat counts >1 for wide glyphs.
If someone complained about this change in behavior, I'd probably
not change it back, as narrow complex Unicode characters exist too.

@lhecker lhecker added Area-Input Related to input processing (key presses, mouse, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) labels Aug 7, 2024
@lhecker lhecker force-pushed the dev/lhecker/igfw-input-buffer branch from b89d446 to 7641a08 Compare August 7, 2024 15:43

This comment has been minimized.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAY. I love getting rid of a big comment that says "this is broke and has been forever"

@lhecker lhecker merged commit 2c452e0 into main Aug 7, 2024
20 checks passed
@lhecker lhecker deleted the dev/lhecker/igfw-input-buffer branch August 7, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants