IS_GLYPH_CHAR macro returns the opposite of what it should #5868

Closed
opened 2026-01-31 00:23:48 +00:00 by claunia · 1 comment
Owner

Originally created by @j4james on GitHub (Jan 12, 2020).

I apologise for not using the template, but this isn't exactly a bug - it's more of a code-health issue.

The way IS_GLYPH_CHAR is defined, it returns TRUE for C0 control characters and DEL, which is the exact opposite of what you would expect.

6f667f48ae/src/host/_stream.cpp (L30)

The only place it's used is here:

6f667f48ae/src/host/_stream.cpp (L398-L400)

Clearly the intention is that the branch should be followed if the char is actually a glyph (or we're in unprocessed mode), but its had to be written as !IS_GLYPH_CHAR to work around the macro being backwards (which just makes the code incredibly confusing).

Originally created by @j4james on GitHub (Jan 12, 2020). I apologise for not using the template, but this isn't exactly a bug - it's more of a code-health issue. The way `IS_GLYPH_CHAR` is defined, it returns TRUE for C0 control characters and DEL, which is the exact opposite of what you would expect. https://github.com/microsoft/terminal/blob/6f667f48ae109d4291cda1f8d4e977315c0dae8a/src/host/_stream.cpp#L30 The only place it's used is here: https://github.com/microsoft/terminal/blob/6f667f48ae109d4291cda1f8d4e977315c0dae8a/src/host/_stream.cpp#L398-L400 Clearly the intention is that the branch should be followed if the char is actually a glyph (or we're in unprocessed mode), but its had to be written as `!IS_GLYPH_CHAR` to work around the macro being backwards (which just makes the code incredibly confusing).
Author
Owner

@zadjii-msft commented on GitHub (Jan 13, 2020):

Wow yea that absolutely is confusing.

@zadjii-msft commented on GitHub (Jan 13, 2020): Wow yea that absolutely is confusing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5868