We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4927

Summary: SDL_SendKeyboardText skips '\r' and '\n' to be reported as text input.
Product: SDL Reporter: ongamex <ongamex>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: amaranth72
Version: 2.0.10   
Hardware: x86   
OS: Windows 10   

Description ongamex 2020-01-04 16:10:08 UTC
SDL_SendKeyboardText skips '\r' and '\n' to be reported as text input.

This happens because:
int SDL_SendKeyboardText(const char *text) {
 // ....
/* Don't post text events for unprintable characters */
if ((unsigned char)*text < ' ' || *text == 127) { // <---- HERE
    return 0;
}

The comment however doesn't describe why we need to do that.
Is is because of some specific platform now reporting it?
WINAPI reports these with WM_CHAR.

I need those events as I'm writing a text editor and I need these in text in some form.

Is there a workaround? Can this if be removed or better documented?
Comment 1 Alex Szpakowski 2020-01-04 17:51:43 UTC
Can your code use SDL_KEYDOWN events for those? That approach has worked well for me in the past.