~jaro/balkon

1c4f51d85e470cec31f12e4173c9985de3c554e3 — Jaro 1 year, 5 months ago cb3f478
Fix style: white space in lambdas.
M src/Data/Text/ParagraphLayout/Internal/ParagraphLine.hs => src/Data/Text/ParagraphLayout/Internal/ParagraphLine.hs +1 -1
@@ 17,7 17,7 @@ instance Line ParagraphLine where

-- | Split the given `ParagraphLayout` into individual lines.
cutLines :: ParagraphLayout -> [ParagraphLine]
cutLines pl = map (\y -> cutLine y pl) (lineOrigins pl)
cutLines pl = map (\ y -> cutLine y pl) (lineOrigins pl)

-- | Reduce the given `ParagraphLayout` to fragments with the given `y_origin`.
--

M src/Data/Text/ParagraphLayout/Internal/Plain.hs => src/Data/Text/ParagraphLayout/Internal/Plain.hs +2 -2
@@ 125,7 125,7 @@ positionLineH originY pfs = (nextY, frags)
        -- This can happen when line breaking produces a line that contains
        -- only spaces.
        nextY = if null rects then originY else maximum $ map y_min rects
        rects = map (\(WithSpan _ r) -> fragmentRect r) frags
        rects = map (\ (WithSpan _ r) -> fragmentRect r) frags
        frags = snd $ mapAccumL (positionFragmentH originY) originX pfs
        originX = paragraphOriginX



@@ 242,7 242,7 @@ layoutRunsH runs = map layoutRunH runs

-- | Sum of all advances within the given fragments.
totalAdvances :: [WithSpan PF.ProtoFragment] -> Int32
totalAdvances pfs = sum $ map (\(WithSpan _ pf) -> PF.advance pf) pfs
totalAdvances pfs = sum $ map (\ (WithSpan _ pf) -> PF.advance pf) pfs

-- | Calculate layout for the given horizontal run and attach extra information.
layoutRunH :: WithSpan Run -> WithSpan PF.ProtoFragment

M src/Data/Text/ParagraphLayout/Internal/TextContainer.hs => src/Data/Text/ParagraphLayout/Internal/TextContainer.hs +1 -1
@@ 77,7 77,7 @@ splitTextsBy' breakFunc closed (tc : tcs) =
        fullSplits = map mergeWithRest tcSplits
        mergeWithRest (x1, x2) =
            (reverse $ collapse $ x1 :| tcs, collapse $ x2 :| closed)
        tcSplits = map (\i -> splitTextAt8 i tc) tcBreakOffsets
        tcSplits = map (\ i -> splitTextAt8 i tc) tcBreakOffsets
        tcBreakOffsets = breakFunc tc

-- | Turn pairs of normal lists into pairs of `NonEmpty` lists,

M test/Data/Text/ParagraphLayout/Internal/BreakSpec.hs => test/Data/Text/ParagraphLayout/Internal/BreakSpec.hs +2 -2
@@ 124,11 124,11 @@ spec = do
                    , "zxx-any-invalid-suffix@lb=loose"
                    ]

            expectedStrictLocales `forM_` \l ->
            expectedStrictLocales `forM_` \ l ->
                it ("uses strict line breaks for " ++ l ++ " locale") $
                    b l jaText `shouldBe` jaBreaksStrict

            expectedLooseLocales `forM_` \l ->
            expectedLooseLocales `forM_` \ l ->
                it ("uses loose line breaks for " ++ l ++ " locale") $
                    b l jaText `shouldBe` jaBreaksLoose


M test/Data/Text/ParagraphLayout/Internal/LinePaginationSpec.hs => test/Data/Text/ParagraphLayout/Internal/LinePaginationSpec.hs +14 -14
@@ 24,7 24,7 @@ spec = do
            let ls = emptyLines
            let page = bestSplit 1 1

            ([-30, -5, 0, 5, 30, 90, 100, 110] :: [Int32]) `forM_` \h ->
            ([-30, -5, 0, 5, 30, 90, 100, 110] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " returns empty lists") $
                    page h ls `shouldBe`
                        ([], [])


@@ 33,17 33,17 @@ spec = do
            let ls = tenLines
            let page = bestSplit 1 1

            ([-30, -5, 0, 5] :: [Int32]) `forM_` \h ->
            ([-30, -5, 0, 5] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts all in second list") $
                    page h ls `shouldBe`
                        ([], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10])

            ([30, 35] :: [Int32]) `forM_` \h ->
            ([30, 35] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts 3 in first list") $
                    page h ls `shouldBe`
                        ([10, 10, 10], [10, 10, 10, 10, 10, 10, 10])

            ([100, 110] :: [Int32]) `forM_` \h ->
            ([100, 110] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts all in first list") $
                    page h ls `shouldBe`
                        ([10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [])


@@ 59,27 59,27 @@ spec = do
            --  -  6 +  4
            --  - 10 +  0

            ([0, 10, 15, 25] :: [Int32]) `forM_` \h ->
            ([0, 10, 15, 25] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " ensures 3 orphans") $
                    page h ls `shouldBe`
                        ([], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10])

            ([30, 35] :: [Int32]) `forM_` \h ->
            ([30, 35] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts 3 in first list") $
                    page h ls `shouldBe`
                        ([10, 10, 10], [10, 10, 10, 10, 10, 10, 10])

            ([40, 45] :: [Int32]) `forM_` \h ->
            ([40, 45] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts 4 in first list") $
                    page h ls `shouldBe`
                        ([10, 10, 10, 10], [10, 10, 10, 10, 10, 10])

            ([60, 75, 90] :: [Int32]) `forM_` \h ->
            ([60, 75, 90] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " ensures 4 widows") $
                    page h ls `shouldBe`
                        ([10, 10, 10, 10, 10, 10], [10, 10, 10, 10])

            ([100, 110] :: [Int32]) `forM_` \h ->
            ([100, 110] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts all in first list") $
                    page h ls `shouldBe`
                        ([10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [])


@@ 92,17 92,17 @@ spec = do
            --  -  6 +  4
            --  - 10 +  0

            ([0, 10, 15, 35, 50, 55] :: [Int32]) `forM_` \h ->
            ([0, 10, 15, 35, 50, 55] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " ensures 6 orphans") $
                    page h ls `shouldBe`
                        ([], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10])

            ([60, 65, 85, 95] :: [Int32]) `forM_` \h ->
            ([60, 65, 85, 95] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts 6 in first list") $
                    page h ls `shouldBe`
                        ([10, 10, 10, 10, 10, 10], [10, 10, 10, 10])

            ([100, 110] :: [Int32]) `forM_` \h ->
            ([100, 110] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts all in first list") $
                    page h ls `shouldBe`
                        ([10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [])


@@ 114,12 114,12 @@ spec = do
            --  -  0 + 10
            --  - 10 +  0

            ([0, 10, 60, 65, 85, 95] :: [Int32]) `forM_` \h ->
            ([0, 10, 60, 65, 85, 95] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts all in second list") $
                    page h ls `shouldBe`
                        ([], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10])

            ([100, 110] :: [Int32]) `forM_` \h ->
            ([100, 110] :: [Int32]) `forM_` \ h ->
                it ("maxHeight = " ++ show h ++ " puts all in first list") $
                    page h ls `shouldBe`
                        ([10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [])

M test/Data/Text/ParagraphLayout/Internal/ZipperSpec.hs => test/Data/Text/ParagraphLayout/Internal/ZipperSpec.hs +2 -2
@@ 89,7 89,7 @@ spec = do
        it "recombines into original text" $ do
            Zipper.recombine z `shouldBe` sampleText

    midPositions `forM_` \n ->
    midPositions `forM_` \ n ->
        describe ("split at " ++ (show n)) $ do
            let z = Zipper.splitAt n sampleText
            it "is not at start" $ do


@@ 103,7 103,7 @@ spec = do
            it "recombines into original text" $ do
                Zipper.recombine z `shouldBe` sampleText

    preMidPositions `forM_` \n ->
    preMidPositions `forM_` \ n ->
        describe ("split at " ++ (show n) ++ " and step") $ do
            let z = Zipper.step $ Zipper.splitAt n sampleText
            it "is not at start" $ do

M test/Data/Text/ParagraphLayoutSpec.hs => test/Data/Text/ParagraphLayoutSpec.hs +6 -6
@@ 156,8 156,8 @@ instance ShouldBeGolden ParagraphLayout where
    shouldBeGolden output_ name = Golden
        { output = output_
        , encodePretty = show
        , writeToFile = \path -> writeFile path . prettyShow
        , readFromFile = \path -> readFile path >>= return . read
        , writeToFile = \ path -> writeFile path . prettyShow
        , readFromFile = \ path -> readFile path >>= return . read
        , goldenFile = ".golden" </> name </> "golden"
        , actualFile = Just (".golden" </> name </> "actual")
        , failFirstTime = True


@@ 167,8 167,8 @@ instance ShouldBeGolden Pages where
    shouldBeGolden output_ name = Golden
        { output = output_
        , encodePretty = show . getPages
        , writeToFile = \path -> writeFile path . prettyShow
        , readFromFile = \path -> readFile path >>= return . Pages . read
        , writeToFile = \ path -> writeFile path . prettyShow
        , readFromFile = \ path -> readFile path >>= return . Pages . read
        , goldenFile = ".golden" </> name </> "golden"
        , actualFile = Just (".golden" </> name </> "actual")
        , failFirstTime = True


@@ 178,8 178,8 @@ instance ShouldBeGolden ShapedRuns where
    shouldBeGolden output_ name = Golden
        { output = output_
        , encodePretty = show . getShapedRuns
        , writeToFile = \path -> writeFile path . prettyShow
        , readFromFile = \path -> readFile path >>= return . ShapedRuns . read
        , writeToFile = \ path -> writeFile path . prettyShow
        , readFromFile = \ path -> readFile path >>= return . ShapedRuns . read
        , goldenFile = ".golden" </> "shapedRuns" </> name </> "golden"
        , actualFile = Just (".golden" </> "shapedRuns" </> name </> "actual")
        , failFirstTime = True