diff --git a/plugins/lua/sort/info.lua b/plugins/lua/sort/info.lua index 62c24d228..861b44484 100644 --- a/plugins/lua/sort/info.lua +++ b/plugins/lua/sort/info.lua @@ -319,7 +319,7 @@ local function on_update(self) end local function on_input(self, clazz, keys) - if keys._MOUSE_R and self.subviews.search.focus then + if keys._MOUSE_R and self.subviews.search.focus and self:get_handled_key() then self.subviews.search:setFocus(false) return true end @@ -350,7 +350,7 @@ function InfoOverlay:init() widgets.BannerPanel{ view_id='panel', frame={l=0, t=0, r=0, h=1}, - visible=function() return get_key() and not is_interrogate_or_convict() end, + visible=self:callback('get_handled_key'), subviews={ widgets.EditField{ view_id='search', @@ -368,6 +368,10 @@ function InfoOverlay:overlay_onupdate() on_update(self) end +function InfoOverlay:get_handled_key() + return not is_interrogate_or_convict() and get_key() or nil +end + local function resize_overlay(self) local sw = dfhack.screen.getWindowSize() local overlay_width = math.min(40, sw-(self.frame_rect.x1 + 30)) @@ -445,6 +449,10 @@ function InterrogationOverlay:overlay_onupdate() on_update(self) end +function InterrogationOverlay:get_handled_key() + return is_interrogate_or_convict() and get_key() or nil +end + function InterrogationOverlay:init() self:addviews{ widgets.Panel{