[PR #4209] Correct the behaviour of the IS_GLYPH_CHAR macro #25697

Closed
opened 2026-01-31 09:11:11 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/4209

State: closed
Merged: Yes


Summary of the Pull Request

This PR reverses the behaviour of the IS_GLYPH_CHAR macro, so it now actually returns true if the given char is a glyph, and false if it isn't. Previously it returned the opposite of that, which meant it had to be called as !IS_GLYPH_CHAR to get the correct result.

PR Checklist

  • Closes Numpad shortcuts with both Ctrl and Shift don't work (#4185)
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #4185

Detailed Description of the Pull Request / Additional comments

The original implementation returned true if the given character was a C0 control, or a DEL:

#define IS_GLYPH_CHAR(wch) (((wch) < L' ') || ((wch) == 0x007F))

It's now the exact opposite, so returns true for characters that are not C0 controls, and are not the DEL character either:

#define IS_GLYPH_CHAR(wch) (((wch) >= L' ') && ((wch) != 0x007F))

The macro was only used in one place, where is was being called as !IS_GLYPH_CHAR when the intent was actually to test whether the char was a glyph. That code could now be updated to remove the !, so it makes more sense.

Validation Steps Performed

I've just tested manually and confirmed that basic output of text and control chars still worked as expected in a conhost shell.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/4209 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This PR reverses the behaviour of the `IS_GLYPH_CHAR` macro, so it now actually returns true if the given char is a glyph, and false if it isn't. Previously it returned the opposite of that, which meant it had to be called as `!IS_GLYPH_CHAR` to get the correct result. ## PR Checklist * [x] Closes #4185 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #4185 ## Detailed Description of the Pull Request / Additional comments The original implementation returned true if the given character was a C0 control, or a DEL: #define IS_GLYPH_CHAR(wch) (((wch) < L' ') || ((wch) == 0x007F)) It's now the exact opposite, so returns true for characters that are _not_ C0 controls, and are not the DEL character either: #define IS_GLYPH_CHAR(wch) (((wch) >= L' ') && ((wch) != 0x007F)) The macro was only used in one place, where is was being called as `!IS_GLYPH_CHAR` when the intent was actually to test whether the char _was_ a glyph. That code could now be updated to remove the `!`, so it makes more sense. ## Validation Steps Performed I've just tested manually and confirmed that basic output of text and control chars still worked as expected in a conhost shell.
claunia added the pull-request label 2026-01-31 09:11:11 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25697