diff --git a/src/input.c b/src/input.c index 3e20be36be..c959da8004 100644 --- a/src/input.c +++ b/src/input.c @@ -1431,7 +1431,7 @@ void title_handle_keyboard_input() // Reserve backtick for console if (key == SDL_SCANCODE_GRAVE) { - if (gConfigGeneral.debugging_tools || gConsoleOpen) { + if ((gConfigGeneral.debugging_tools && !platform_is_input_active()) || gConsoleOpen) { window_cancel_textbox(); console_toggle(); } @@ -1502,7 +1502,7 @@ void game_handle_keyboard_input() // Reserve backtick for console if (key == SDL_SCANCODE_GRAVE) { - if (gConfigGeneral.debugging_tools || gConsoleOpen) { + if ((gConfigGeneral.debugging_tools && !platform_is_input_active()) || gConsoleOpen) { window_cancel_textbox(); console_toggle(); } diff --git a/src/platform/platform.h b/src/platform/platform.h index 23cde3c2b6..c040e4794f 100644 --- a/src/platform/platform.h +++ b/src/platform/platform.h @@ -141,6 +141,7 @@ void platform_process_messages(); int platform_scancode_to_rct_keycode(int sdl_key); void platform_start_text_input(utf8 *buffer, int max_length); void platform_stop_text_input(); +bool platform_is_input_active(); void platform_get_date_utc(rct2_date *out_date); void platform_get_time_utc(rct2_time *out_time); void platform_get_date_local(rct2_date *out_date); diff --git a/src/platform/shared.c b/src/platform/shared.c index 31c7f65f57..f71e61ecc5 100644 --- a/src/platform/shared.c +++ b/src/platform/shared.c @@ -652,6 +652,11 @@ void platform_start_text_input(utf8* buffer, int max_length) textinputbuffer_init(&gTextInput, buffer, max_length); } +bool platform_is_input_active() +{ + return SDL_IsTextInputActive() && gTextInput.buffer != NULL; +} + void platform_stop_text_input() { SDL_StopTextInput();