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:
parent
67c9056bed
commit
635a4eac05
@ -1108,10 +1108,9 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
}
|
||||
|
||||
if (ELEM(status, XLookupChars, XLookupBoth)) {
|
||||
if (uchar(utf8_buf[0]) >= 32) { /* not an ascii control character */
|
||||
/* do nothing for now, this is valid utf8 */
|
||||
}
|
||||
else {
|
||||
/* Check for ASCII control characters.
|
||||
* Inline `iscntrl` because the users locale must not change behavior. */
|
||||
if ((utf8_buf[0] < 32 && utf8_buf[0] > 0) || (utf8_buf[0] == 127)) {
|
||||
utf8_buf[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user