Fix delete key setting a control character in wmEvent::utf8_buf

The check for control characters didn't account for delete (127).
This wasn't noticeable in most cases as delete is mapped to delete text.
Pressing Shift-Delete would enter 127 control character in the
text-editor, 3D text & Python console. This happened X11 & Wayland,
I didn't check other platforms.
This commit is contained in:
Campbell Barton
2023-09-15 16:00:43 +10:00
parent 67c9056bed
commit 635a4eac05
2 changed files with 6 additions and 5 deletions

View File

@@ -5670,7 +5670,9 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, const int type,
event.utf8_buf[0] = '\0';
}
else {
if (event.utf8_buf[0] < 32 && event.utf8_buf[0] > 0) {
/* Check for ASCII control characters.
* Inline `iscntrl` because the users locale must not change behavior. */
if ((event.utf8_buf[0] < 32 && event.utf8_buf[0] > 0) || (event.utf8_buf[0] == 127)) {
event.utf8_buf[0] = '\0';
}
}