From 692399ac4569809e3d30dd73812808a10adb6f9c Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 27 Jan 2026 15:30:44 +0100 Subject: [PATCH] when you press e.g. 'b' to enter a text dialog, 'b' is not sent to this dialog --- control.cpp | 6 +++++- dialogs.cpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/control.cpp b/control.cpp index ca1e526c..4ed6d8cc 100644 --- a/control.cpp +++ b/control.cpp @@ -1255,6 +1255,7 @@ EX void mainloopiter() { if(((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MMASK)) && !mouseout2()) currently_scrolling = true; + ignore_textinput = false; ui_mousex = mousex, ui_mousey = mousey; #if SDLVER >= 2 if(timetowait > 0) { @@ -1275,6 +1276,8 @@ EX void mainloopiter() { EX bool need_refresh; EX int ui_mousex, ui_mousey; +EX bool ignore_textinput; + EX void refresh_if_needed() { if(!need_refresh) return; just_refreshing = 1; @@ -1427,7 +1430,8 @@ EX void handle_event(SDL_Event& ev) { #if SDLVER >= 2 if(ev.type == SDL_EVENT_TEXT_INPUT) { refresh_if_needed(); - texthandler(ev.text); + if(ignore_textinput) ignore_textinput = false; + else texthandler(ev.text); } #endif diff --git a/dialogs.cpp b/dialogs.cpp index d88f28aa..4660c9fc 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -995,10 +995,12 @@ EX namespace dialog { EX void handle_actions(int &sym, int &uni) { if(key_actions.count(uni)) { key_actions[uni](); + if(uni >= ' ' && uni <= 127) ignore_textinput = true; sym = uni = 0; return; } if(key_actions.count(sym)) { + if(sym >= ' ' && sym <= 127) ignore_textinput = true; key_actions[sym](); sym = uni = 0; return;