summaryrefslogtreecommitdiffstats
path: root/src/State.hs
blob: 2cb1575a1d614e275e5ec3a48d5e9ed02ad9a8a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
      }