summaryrefslogtreecommitdiffstats
path: root/src/State.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-04-05 21:39:55 +0200
committertv <tv@krebsco.de>2022-04-05 22:06:40 +0200
commitf4cdf79bd4a75e9eafe68b9a908f4cc68682b7ef (patch)
treed2cb50df2344d97042b2c006ee39811e2b87511d /src/State.hs
parent032cb86ff8108eb4915a692015da344a41f78506 (diff)
boom
Diffstat (limited to 'src/State.hs')
-rw-r--r--src/State.hs58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/State.hs b/src/State.hs
new file mode 100644
index 0000000..2cb1575
--- /dev/null
+++ b/src/State.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE OverloadedStrings #-}
+module State where
+
+import Blessings.Text (Blessings)
+import Data.Default (Default,def)
+import Data.Map (Map)
+import Data.Text (Text)
+import Hack.Buffer (Buffer)
+import Pager.Types
+import qualified Data.Map as Map
+import qualified Hack.Buffer as Buffer
+
+
+data State = State
+ { buffer :: Buffer
+ , command :: Command
+ , count :: Int
+ , flashMessage :: Blessings Text
+ , termWidth :: Int
+ , termHeight :: Int
+ , charHeight :: Int
+ , charWidth :: Int
+ , screenWidth :: Int
+ , screenHeight :: Int
+ , termHeightPixels :: Int
+ , termWidthPixels :: Int
+ , termBorder :: Int
+ , workspaceViewportHeight :: Int
+ , workspaceViewportOffset :: Int
+ , foundWorkspaces :: [Text]
+ , workspaces :: Map Text Workspace
+ , workspaceCursor :: Int
+ , ex_offsetY :: Int
+ }
+
+
+instance Default State where
+ def = State
+ { buffer = Buffer.emptyBuffer
+ , command = ViewWorkspace
+ , count = 1
+ , flashMessage = "Welcome to pager; quit with ^C"
+ , termWidth = 0
+ , termHeight = 0
+ , screenHeight = 0
+ , screenWidth = 0
+ , charWidth = 0
+ , charHeight = 0
+ , termWidthPixels = 0
+ , termHeightPixels = 0
+ , termBorder = 0
+ , workspaceViewportHeight = 0
+ , workspaceViewportOffset = 0
+ , foundWorkspaces = []
+ , workspaces = Map.empty
+ , workspaceCursor = 0
+ , ex_offsetY = 0
+ }