-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract utils from Controller and View
- Loading branch information
Showing
7 changed files
with
189 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{-# LANGUAGE PatternSynonyms #-} | ||
|
||
module Swarm.TUI.Controller.ControllerUtils where | ||
|
||
import Brick hiding (Direction) | ||
import Graphics.Vty qualified as V | ||
|
||
-- | Pattern synonyms to simplify brick event handler | ||
pattern Key :: V.Key -> BrickEvent n e | ||
pattern Key k = VtyEvent (V.EvKey k []) | ||
|
||
pattern CharKey, ControlChar, MetaChar :: Char -> BrickEvent n e | ||
pattern CharKey c = VtyEvent (V.EvKey (V.KChar c) []) | ||
pattern ControlChar c = VtyEvent (V.EvKey (V.KChar c) [V.MCtrl]) | ||
pattern MetaChar c = VtyEvent (V.EvKey (V.KChar c) [V.MMeta]) | ||
|
||
pattern ShiftKey :: V.Key -> BrickEvent n e | ||
pattern ShiftKey k = VtyEvent (V.EvKey k [V.MShift]) | ||
|
||
pattern EscapeKey :: BrickEvent n e | ||
pattern EscapeKey = VtyEvent (V.EvKey V.KEsc []) | ||
|
||
pattern FKey :: Int -> BrickEvent n e | ||
pattern FKey c = VtyEvent (V.EvKey (V.KFun c) []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.