From 5af5998ff01344447d1c68541226b21eb77b2b4e Mon Sep 17 00:00:00 2001 From: Jaro Date: Sat, 8 Apr 2023 16:32:10 +0200 Subject: [PATCH] Move paragraphSpanBounds to the correct module. --- src/Data/Text/ParagraphLayout/Internal/Paragraph.hs | 10 ++++++++++ .../Text/ParagraphLayout/Internal/ParagraphLayout.hs | 11 ----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Data/Text/ParagraphLayout/Internal/Paragraph.hs b/src/Data/Text/ParagraphLayout/Internal/Paragraph.hs index 2340529..8abc2f5 100644 --- a/src/Data/Text/ParagraphLayout/Internal/Paragraph.hs +++ b/src/Data/Text/ParagraphLayout/Internal/Paragraph.hs @@ -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) diff --git a/src/Data/Text/ParagraphLayout/Internal/ParagraphLayout.hs b/src/Data/Text/ParagraphLayout/Internal/ParagraphLayout.hs index 6d73d77..3a48d72 100644 --- a/src/Data/Text/ParagraphLayout/Internal/ParagraphLayout.hs +++ b/src/Data/Text/ParagraphLayout/Internal/ParagraphLayout.hs @@ -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 -- 2.30.2