Skip to content

Commit

Permalink
Fix handler triggers; v0.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
someodd committed Dec 9, 2020
1 parent fec8efc commit 063da11
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.24.0] - 2020-12-09

### Fix

* Prevent homepage from being launched during modes where it shouldn't, like
GotoMode and SearchMode
* Allow GotoMode to be launched while viewing bookmarks

## [0.23.0] - 2020-11-25

### Add
Expand Down
11 changes: 8 additions & 3 deletions src/BrickApp/Handle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ doEventIfModeTrue gbs func successEvent failEvent
| otherwise = failEvent


-- FIXME: the way I'm handling input here is bad. It relies on whitelisting which modes are allowed
-- to initiate a new mode/use a command. So for example, if I ever add a new thing that handles input,
-- the homepage event handler might active, unless homepage event handler is whitelisted, which then
-- a problem occurs where homepagemode might not be tripped if and when it actually should be during
-- a new mode that gets added!
-- FIXME: shouldn't history be handled top level and not in individual handlers? or are there
-- some cases where we don't want history available
--
Expand Down Expand Up @@ -104,13 +109,13 @@ appEvent gbs (B.VtyEvent (V.EvKey (V.KChar 'b') [V.MCtrl])) =
in doEventIfModeTrue gbs (/= BookmarksMode) successEvent failureEvent
-- GotoMode
appEvent gbs (B.VtyEvent e@(V.EvKey (V.KChar 'g') [V.MCtrl])) =
doEventIfModeTrue gbs (`elem` [MenuMode, TextFileMode, HelpMode]) (B.continue $ initGotoMode gbs) (appropriateHandler gbs e)
doEventIfModeTrue gbs (`elem` [BookmarksMode, MenuMode, TextFileMode, HelpMode]) (B.continue $ initGotoMode gbs) (appropriateHandler gbs e)
-- TODO: needs to reset viewport
appEvent gbs (B.VtyEvent e@(V.EvKey (V.KChar '?') [])) =
doEventIfModeTrue gbs (== HelpMode) (appropriateHandler gbs e) (liftIO (modifyGbsForHelp gbs) >>= B.continue)
-- Go to the homepage
appEvent gbs (B.VtyEvent (V.EvKey (V.KChar 'h') [])) =
(liftIO $ goHome gbs) >>= B.continue
appEvent gbs (B.VtyEvent e@(V.EvKey (V.KChar 'h') [])) =
doEventIfModeTrue gbs (`elem` [BookmarksMode, MenuMode, TextFileMode, HelpMode]) ((liftIO $ goHome gbs) >>= B.continue) (appropriateHandler gbs e)
-- Set the homepage
-- FIXME: why does ctrl h not work?
appEvent gbs (B.VtyEvent (V.EvKey (V.KChar 'z') [V.MCtrl])) =
Expand Down
2 changes: 1 addition & 1 deletion waffle.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ name: waffle
-- PVP summary: +-+------- breaking API changes
-- | | +----- non-breaking API additions
-- | | | +--- code changes with no API change
version: 0.23.0.0
version: 0.24.0.0

-- A short (one-line) description of the package.
synopsis: Gopher protocol TUI client
Expand Down

0 comments on commit 063da11

Please sign in to comment.