summaryrefslogtreecommitdiffstats
path: root/src/TextViewport/Buffer/Item.hs
blob: b08aaf4b82d870c02c483e8f789a6751366b5e4d (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
module TextViewport.Buffer.Item where

import Data.Text (Text)
import Data.HashMap.Strict qualified as HM
import Text.Hyphenation qualified as H


data Item = Item
  { itemText :: Text
  , itemSegments :: SegmentStrategy
  }
  deriving (Eq, Show)

data SegmentStrategy
  = NoSegments
  | FixedWidthSegments
  | HyphenateSegments
      { hsDict  :: H.Hyphenator
      , hsCache :: HM.HashMap Text [(Text, Text)]
      }
  deriving (Eq, Show)

instance Show H.Hyphenator where
  show _ = "<Hyphenator>"

instance Eq H.Hyphenator where
  a == b =  False