on develop help sign in
input: Fix inputInFocusedRegion so that clicked node can _gain_ focus
commitcf82eec73c6733cff33c5102e3bd88b9c6823b57 authorAli Abrar <aliabrar@gmail.com> dateFri 26 Mar 2021, 12:40 (6 years ago) parentb7f7b18
1 file changed+6−2
src/Reflex/Vty/Widget.hs+6−2
src/Reflex/Vty/Widget.hs+6−2
@@ -206,8 +206,12 @@ inputInFocusedRegion
206206inputInFocusedRegion = do
207207 inp <- input
208208 reg <- current <$> askRegion
209− f <- current <$> focus
210− pure $ gate f $ fmapMaybe id $ attachWith mouseInRegion reg inp
209+ foc <- current <$> focus
210+ pure $ fmapMaybe id $ attachWith filterInput ((,) <$> reg <*> foc) inp
211+ where
212+ filterInput (r, f) = \case
213+ V.EvKey {} | not f -> Nothing
214+ x -> mouseInRegion r x
211215
212216-- * Getting and setting the display region
213217