SDL_TextEditingEvent(3type)

SDL_TextEditingEvent πŸ’…βœ¨

okay bestie, welcome to the SDL3 DATATYPES corner of the manual, where we talk about the keyboard text editing event structure β€” you'll see it in the wild as event.edit.* and it's genuinely so cute of it.


✨ SYNOPSIS ✨

#include <SDL3/SDL_events.h>

typedef struct SDL_TextEditingEvent
{
    SDL_EventType type;         /**< SDL_EVENT_TEXT_EDITING */
    Uint32 reserved;
    Uint64 timestamp;           /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_WindowID windowID;      /**< The window with keyboard focus, if any */
    const char *text;           /**< The editing text */
    Sint32 start;               /**< The start cursor of selected editing text, or -1 if not set */
    Sint32 length;              /**< The length of selected editing text, or -1 if not set */
} SDL_TextEditingEvent;

like, look at her. she's giving struct and she's serving every field you need. no notes. 🫢


🌸 DESCRIPTION 🌸

so the start cursor is literally the position β€” counted in UTF-8 characters β€” where your brand new typing is gonna get inserted into the editing text. main character insertion point energy, fr fr.

and the length? that's the number of UTF-8 characters that are gonna get replaced by that new typing. gone. deleted. replaced. periodt. πŸ’…


πŸ¦‹ AVAILABILITY πŸ¦‹

this struct has been around since SDL 3.2.0. she's not new new, but she's still iconic.


ngl if you're handling IME / text editing, this is your girl β€” don't sleep on her πŸ’–

and that's the whole vibe check, bestie! this page came to you from Simple Directmedia Layer, SDL 3.4.18, filed under SDL_TextEditingEvent(3type) β€” go forth and slay your text editing βœ¨πŸŽ€πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from