revert pattern brackets

This commit is contained in:
Willem Van Onsem 2021-02-15 23:59:25 +01:00
parent 0e5c1646f6
commit 9c479554ee
5 changed files with 15 additions and 15 deletions

View File

@ -297,7 +297,7 @@ cropBottom h inI
| otherwise = go inI
where
go EmptyImage = EmptyImage
go i@CropBottom {croppedImage, outputWidth, outputHeight}
go i@(CropBottom {croppedImage, outputWidth, outputHeight})
| outputHeight <= h = i
| otherwise = CropBottom croppedImage outputWidth h
go i
@ -314,7 +314,7 @@ cropRight w inI
| otherwise = go inI
where
go EmptyImage = EmptyImage
go i@CropRight {croppedImage, outputWidth, outputHeight}
go i@(CropRight {croppedImage, outputWidth, outputHeight})
| outputWidth <= w = i
| otherwise = CropRight croppedImage w outputHeight
go i
@ -331,7 +331,7 @@ cropLeft w inI
| otherwise = go inI
where
go EmptyImage = EmptyImage
go i@CropLeft {croppedImage, leftSkip, outputWidth, outputHeight}
go i@(CropLeft {croppedImage, leftSkip, outputWidth, outputHeight})
| outputWidth <= w = i
| otherwise =
let leftSkip' = leftSkip + outputWidth - w
@ -350,7 +350,7 @@ cropTop h inI
| otherwise = go inI
where
go EmptyImage = EmptyImage
go i@CropTop {croppedImage, topSkip, outputWidth, outputHeight}
go i@(CropTop {croppedImage, topSkip, outputWidth, outputHeight})
| outputHeight <= h = i
| otherwise =
let topSkip' = topSkip + outputHeight - h

View File

@ -150,25 +150,25 @@ ppImageStructure inImg = go 0 inImg
where
go indent img = tab indent ++ pp indent img
tab indent = concat $ replicate indent " "
pp _ HorizText {outputWidth} = "HorizText(" ++ show outputWidth ++ ")"
pp _ BGFill {outputWidth, outputHeight}
pp _ (HorizText {outputWidth}) = "HorizText(" ++ show outputWidth ++ ")"
pp _ (BGFill {outputWidth, outputHeight})
= "BGFill(" ++ show outputWidth ++ "," ++ show outputHeight ++ ")"
pp i HorizJoin {partLeft = l, partRight = r, outputWidth = c}
pp i (HorizJoin {partLeft = l, partRight = r, outputWidth = c})
= "HorizJoin(" ++ show c ++ ")\n" ++ go (i+1) l ++ "\n" ++ go (i+1) r
pp i VertJoin {partTop = t, partBottom = b, outputWidth = c, outputHeight = r}
pp i (VertJoin {partTop = t, partBottom = b, outputWidth = c, outputHeight = r})
= "VertJoin(" ++ show c ++ ", " ++ show r ++ ")\n"
++ go (i+1) t ++ "\n"
++ go (i+1) b
pp i CropRight {croppedImage, outputWidth, outputHeight}
pp i (CropRight {croppedImage, outputWidth, outputHeight})
= "CropRight(" ++ show outputWidth ++ "," ++ show outputHeight ++ ")\n"
++ go (i+1) croppedImage
pp i CropLeft {croppedImage, leftSkip, outputWidth, outputHeight}
pp i (CropLeft {croppedImage, leftSkip, outputWidth, outputHeight})
= "CropLeft(" ++ show leftSkip ++ "->" ++ show outputWidth ++ "," ++ show outputHeight ++ ")\n"
++ go (i+1) croppedImage
pp i CropBottom {croppedImage, outputWidth, outputHeight}
pp i (CropBottom {croppedImage, outputWidth, outputHeight})
= "CropBottom(" ++ show outputWidth ++ "," ++ show outputHeight ++ ")\n"
++ go (i+1) croppedImage
pp i CropTop {croppedImage, topSkip, outputWidth, outputHeight}
pp i (CropTop {croppedImage, topSkip, outputWidth, outputHeight})
= "CropTop("++ show outputWidth ++ "," ++ show topSkip ++ "->" ++ show outputHeight ++ ")\n"
++ go (i+1) croppedImage
pp _ EmptyImage = "EmptyImage"

View File

@ -143,7 +143,7 @@ readFromDevice = do
return stringRep
applyConfig :: Fd -> Config -> IO ()
applyConfig fd Config{ vmin = Just theVmin, vtime = Just theVtime }
applyConfig fd (Config{ vmin = Just theVmin, vtime = Just theVtime })
= setTermTiming fd theVmin (theVtime `div` 100)
applyConfig _ _ = fail "(vty) applyConfig was not provided a complete configuration"

View File

@ -109,7 +109,7 @@ substituteSkips ClearBackground ops = do
let rowOps'' = swapSkipsForSingleColumnCharSpan ' ' currentAttr rowOps'
MVector.write ops row rowOps''
return ops
substituteSkips Background {backgroundChar, backgroundAttr} ops = do
substituteSkips (Background {backgroundChar, backgroundAttr}) ops = do
-- At this point we decide if the background character is single
-- column or not. obviously, single column is easier.
case safeWcwidth backgroundChar of

View File

@ -56,7 +56,7 @@ splitOpsAt inW inOps = splitOpsAt' inW inOps
where
splitOpsAt' 0 ops = (Vector.empty, ops)
splitOpsAt' remainingColumns ops = case Vector.head ops of
t@TextSpan {} -> if remainingColumns >= textSpanOutputWidth t
t@(TextSpan {}) -> if remainingColumns >= textSpanOutputWidth t
then let (pre,post) = splitOpsAt' (remainingColumns - textSpanOutputWidth t)
(Vector.tail ops)
in (Vector.cons t pre, post)