diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-10-04 18:07:30 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-10-04 19:10:06 +0530 |
| commit | a302dfc2aabda53446fb38e035e61ae91b28f84a (patch) | |
| tree | 67ca03f33ebf31e198ac5a883100b96cc387f264 /lib/Daffm/Types.hs | |
| parent | b05be850349dbb813d2af6f3ee7a2fc3bf98b8ef (diff) | |
| download | daffm-a302dfc2aabda53446fb38e035e61ae91b28f84a.tar.gz daffm-a302dfc2aabda53446fb38e035e61ae91b28f84a.zip | |
Add multi-key handling + command parsing + shell/shell! aliases
Diffstat (limited to 'lib/Daffm/Types.hs')
| -rw-r--r-- | lib/Daffm/Types.hs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/Daffm/Types.hs b/lib/Daffm/Types.hs index ffff4d0..953e3a8 100644 --- a/lib/Daffm/Types.hs +++ b/lib/Daffm/Types.hs @@ -6,6 +6,7 @@ import qualified Brick.Widgets.List as L import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.Text as Text +import qualified Graphics.Vty as V import System.Posix.Types (FileMode, FileOffset) data FileType @@ -39,10 +40,36 @@ data AppState = AppState stateFocusTarget :: FocusTarget, stateCwd :: FilePathText, stateListPositionCache :: Map.Map Text.Text Int, - stateParentDir :: FilePathText + stateParentDir :: FilePathText, + stateKeySequence :: KeySequence, + stateKeyMap :: Keymap } deriving (Show) type AppEvent = EventM FocusTarget AppState type CmdlineEditor = Editor.Editor Text.Text FocusTarget + +data KeyMatchResult = MatchSuccess Command | MatchPartial | MatchFailure + deriving (Show, Eq) + +data Command + = CmdShell Bool Text.Text + | CmdQuit + | CmdSetCmdline Text.Text + | CmdEnterCmdline + | CmdLeaveCmdline + | CmdOpenSelection + | CmdChangeDir Text.Text + | CmdReload + | CmdToggleSelection + | CmdClearSelection + | CmdGoBack + | CmdNoop + deriving (Show, Eq) + +type Key = V.Key + +type Keymap = Map.Map [Key] Command + +type KeySequence = [Key] |
