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 - SDL_SendKeyboardText skips '\r' and '\n' to be reported as text input.
Summary: SDL_SendKeyboardText skips '\r' and '\n' to be reported as text input.
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.10
Hardware: x86 Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-04 16:10 UTC by ongamex
Modified: 2020-01-04 17:51 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.