Use UTF8 length to decide if a TEXTINPUT is a hotkey (should fix #1855)

This commit is contained in:
Celtic Minstrel 2017-07-26 22:52:02 -04:00 committed by Jyrki Vesterinen
parent 62ec3b3951
commit 047120e2fa

View File

@ -29,6 +29,7 @@
#include "display.hpp" #include "display.hpp"
#include "quit_confirmation.hpp" #include "quit_confirmation.hpp"
#include "show_dialog.hpp" #include "show_dialog.hpp"
#include "unicode.hpp"
#include "utils/functional.hpp" #include "utils/functional.hpp"
@ -520,10 +521,7 @@ static void event_execute( const SDL_Event& event, command_executor* executor)
if(!CKey::is_uncomposable(event.key) && !(mods & KMOD_CTRL) && !(mods & KMOD_ALT) && !(mods & KMOD_GUI)) { if(!CKey::is_uncomposable(event.key) && !(mods & KMOD_CTRL) && !(mods & KMOD_ALT) && !(mods & KMOD_GUI)) {
return; return;
} }
} else if(event.type == SDL_TEXTINPUT && ( } else if(event.type == SDL_TEXTINPUT && event.text.text[31] == 0 && utf8::size(utf8::string(event.text.text)) == 1) {
static_cast<signed char>(event.text.text[0]) <= '\0' ||
(event.text.text[1] != '\0')))
{
return; return;
} }