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 4774

Summary: SDL_TEXTEDITINGEVENT_TEXT_SIZE is too small for Japanese
Product: SDL Reporter: tamo <ttakah+sdl>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: HG 2.1   
Hardware: All   
OS: All   
Attachments: increase buffer size
malloc the text, hoping it will be freed

Description tamo 2019-08-28 00:03:33 UTC
Japanese people use IME in various ways.
Some of them use it for inputting one or even more whole sentences at a time.
So the length of textediting buffers is too small. At least 256, maybe more is needed.
Accordingly, SDL_TEXTINPUTEVENT_TEXT_SIZE should be made longer, too.

example:

Someone use IME to convert the following sentence
にほんじんはいちどにながいぶんしょうをにゅうりょくすることがあるのでそうおうのばっふぁをよういするひつようがある。

to input
日本人は一度に長い文章を入力することがあるので相応のバッファを用意する必要がある。
Comment 1 tamo 2019-08-30 01:34:20 UTC
Created attachment 3934 [details]
increase buffer size
Comment 2 tamo 2019-08-30 02:51:31 UTC
I attached a file, but it is not ready for building.
Without quite a big change in code, the buffer size cannot be increased over 36.
(struct size limit is 56, and SDL_TextEditingEvent has 5 Uint32s, so 56-5*4==36)
Can you consider a malloc/free or some better ways to get larger size?

36 is much better than 32, but we need more.
Comment 3 tamo 2019-08-31 15:51:35 UTC
Created attachment 3939 [details]
malloc the text, hoping it will be freed

I successfully built SDL2.dll with this patch and tried testime.exe on Windows.
This works for me. But take it as a PoC, not a finished work. I don't know anything about its performance impact, API breakage, or how to implement the same change for other platforms.
Comment 4 tamo 2019-09-01 19:35:57 UTC
This is a dup of #3006

*** This bug has been marked as a duplicate of bug 3006 ***