~jaro/balkon

5af5998ff01344447d1c68541226b21eb77b2b4e — Jaro 1 year, 7 months ago aa671a1
Move paragraphSpanBounds to the correct module.
M src/Data/Text/ParagraphLayout/Internal/Paragraph.hs => src/Data/Text/ParagraphLayout/Internal/Paragraph.hs +10 -0
@@ 1,10 1,13 @@
module Data.Text.ParagraphLayout.Internal.Paragraph
    ( Paragraph (..)
    , ParagraphOptions (..)
    , paragraphSpanBounds
    )
where

import Data.Int (Int32)
import Data.List.NonEmpty (NonEmpty)
import qualified Data.List.NonEmpty as NonEmpty
import Data.Text.Array (Array)
import Data.Text.Glyphize (Font)



@@ 70,3 73,10 @@ data ParagraphOptions = ParagraphOptions

    }
    deriving (Eq, Show)

-- | Calculate the offsets into the `Paragraph`'s underlying `Data.Text.Array`
-- where each span starts and ends, in ascending order. The resulting list
-- will be one larger than the list of input spans.
paragraphSpanBounds :: Paragraph -> NonEmpty Int
paragraphSpanBounds (Paragraph _ initialOffset spans _) =
    NonEmpty.scanl (+) initialOffset (map spanLength spans)

M src/Data/Text/ParagraphLayout/Internal/ParagraphLayout.hs => src/Data/Text/ParagraphLayout/Internal/ParagraphLayout.hs +0 -11
@@ 8,17 8,13 @@ module Data.Text.ParagraphLayout.Internal.ParagraphLayout
    , paragraphLayout
    , paragraphOriginX
    , paragraphOriginY
    , paragraphSpanBounds
    , shapedRuns
    )
where

import Data.Int (Int32)
import Data.List.NonEmpty (NonEmpty)
import qualified Data.List.NonEmpty as NonEmpty

import Data.Text.ParagraphLayout.Internal.Fragment
import Data.Text.ParagraphLayout.Internal.Paragraph
import Data.Text.ParagraphLayout.Internal.Rect
import Data.Text.ParagraphLayout.Internal.Span



@@ 30,13 26,6 @@ data ParagraphLayout = ParagraphLayout
    }
    deriving (Eq, Read, Show)

-- | Calculate the offsets into the `Paragraph`'s underlying `Data.Text.Array`
-- where each span starts and ends, in ascending order. The resulting list
-- will be one larger than the list of input spans.
paragraphSpanBounds :: Paragraph -> NonEmpty Int
paragraphSpanBounds (Paragraph _ initialOffset spans _) =
    NonEmpty.scanl (+) initialOffset (map spanLength spans)

paragraphOriginX :: (Num a) => a
paragraphOriginX = 0