diff --git a/docs/changelog.txt b/docs/changelog.txt index 3c7f28fe9f..819aba4792 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -74,6 +74,7 @@ Template for new versions: - `autodump`: ``destroy`` no longer leaves the contents of destroyed containers in limbo or crashes when destroying unit-held items - `buildingplan`: fix roller material estimate asking for one chain per tile instead of one chain total - `buildingplan`: fix "Unlink all" only unlinking some mechanisms (or crashing) when freeing mechanisms from the building +- `overlay`: overlay hotkeys no longer steal typed characters while the game is capturing text input, e.g. when renaming a building - `sort`: fix the Places/Workshops and task searches missing workshops by their current display names (e.g. "Stoneworker's Workshop", "Screw Press") - `stocks`: overlay now resets scroll position when collapsing categories so the item list is no longer left blank and unscrollable - `strangemood`: updated to match behavior of current DF version diff --git a/plugins/lua/overlay.lua b/plugins/lua/overlay.lua index c45180fabe..95437c7993 100644 --- a/plugins/lua/overlay.lua +++ b/plugins/lua/overlay.lua @@ -534,7 +534,25 @@ local function _feed_viewscreen_widgets(vs_name, vs, keys) return false end +-- when the native UI is capturing text input (renaming a building, editing a +-- workshop job filter, etc.), overlay widgets must not consume keys, since +-- their bound hotkeys would otherwise steal typed characters (#5764) +local function is_native_text_entry_active() + local mi = df.global.game.main_interface + local vs = mi.view_sheets + return mi.entering_building_name or + vs.building_entering_nickname or + vs.unit_overview_entering_nickname or + vs.unit_overview_entering_profession_nickname or + vs.entering_building_job_filter or + vs.entering_gen_work_order_num or + vs.entering_wq_number +end + function feed_viewscreen_widgets(vs_name, vs, keys) + if is_native_text_entry_active() then + return false + end if not _feed_viewscreen_widgets(vs_name, vs, keys) and not _feed_viewscreen_widgets('all', nil, keys) then return false