diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-12-25 12:28:47 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-12-25 13:48:00 +0530 |
| commit | b4fe44842fb6914f9060b0d018de53983b0aab0b (patch) | |
| tree | ee0d740e4500153c859d5fa02d4f6f8fa95404e6 /lib/Daffm/State.hs | |
| parent | 2a2ee4a51e160406522c8c3136dfbc030ad3dcdd (diff) | |
| download | daffm-b4fe44842fb6914f9060b0d018de53983b0aab0b.tar.gz daffm-b4fe44842fb6914f9060b0d018de53983b0aab0b.zip | |
Add env vars for managing escape-free commands
Diffstat (limited to '')
| -rw-r--r-- | lib/Daffm/State.hs | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/lib/Daffm/State.hs b/lib/Daffm/State.hs index bc91ecb..9b3d81d 100644 --- a/lib/Daffm/State.hs +++ b/lib/Daffm/State.hs @@ -28,21 +28,30 @@ mkEditor = Editor.editor FocusCmdline (Just 1) mkEmptyAppState :: Configuration -> AppState mkEmptyAppState config = - AppState - { stateFiles = L.list FocusMain (Vec.fromList []) 1, - stateMessage = Nothing, - stateCmdlineEditor = mkEditor "", - stateFocusTarget = FocusMain, - stateListPositionHistory = Map.empty, - stateFileSelections = Set.empty, - stateCwd = "", - stateKeyMap = configKeymap config, + applyConfigToState config $ + AppState + { stateFiles = L.list FocusMain (Vec.fromList []) 1, + stateMessage = Nothing, + stateCmdlineEditor = mkEditor "", + stateFocusTarget = FocusMain, + stateListPositionHistory = Map.empty, + stateFileSelections = Set.empty, + stateCwd = "", + stateKeyMap = Map.empty, + stateOpenerScript = Nothing, + stateKeySequence = [], + stateSearchTerm = Nothing, + stateSearchMatches = Vec.empty, + stateCustomCommands = Map.empty, + stateSearchIndex = 0 + } + +applyConfigToState :: Configuration -> AppState -> AppState +applyConfigToState config state = + state + { stateKeyMap = configKeymap config, stateOpenerScript = configOpener config, - stateKeySequence = [], - stateSearchTerm = Nothing, - stateSearchMatches = Vec.empty, - stateCustomCommands = configCommands config, - stateSearchIndex = 0 + stateCustomCommands = configCommands config } toggleSetItem :: (Ord a) => a -> Set.Set a -> Set.Set a |
