Skip to content
Snippets Groups Projects
Commit ffaf6130 authored by Jens Nolte's avatar Jens Nolte
Browse files

Fix autoPadding

parent 37e5f4f6
No related branches found
No related tags found
No related merge requests found
...@@ -110,16 +110,21 @@ modify :: (BlockOutput -> BlockOutput) ...@@ -110,16 +110,21 @@ modify :: (BlockOutput -> BlockOutput)
-> Pipe (Maybe BlockOutput) (Maybe BlockOutput) BarIO r -> Pipe (Maybe BlockOutput) (Maybe BlockOutput) BarIO r
modify x = PP.map (x <$>) modify x = PP.map (x <$>)
autoPadding :: Pipe BlockOutput BlockOutput BarIO r autoPadding :: Pipe (Maybe BlockOutput) (Maybe BlockOutput) BarIO r
autoPadding = autoPadding' 0 0 autoPadding = autoPadding' 0 0
where where
autoPadding' :: Int64 -> Int64 -> Pipe BlockOutput BlockOutput BarIO r autoPadding' :: Int64 -> Int64 -> Pipe (Maybe BlockOutput) (Maybe BlockOutput) BarIO r
autoPadding' fullLength shortLength = do autoPadding' fullLength shortLength = do
block <- await maybeBlock <- await
let fullLength' = max fullLength . printedLength $ block^.fullText case maybeBlock of
let shortLength' = max shortLength . printedLength $ block^.shortText._Just -- TODO: ??? Just block -> do
yield $ padFullText fullLength' . padShortText shortLength' $ block let fullLength' = max fullLength . printedLength $ block^.fullText
autoPadding' fullLength' shortLength' let shortLength' = max shortLength . printedLength $ block^.shortText._Just -- TODO: ???
yield $ Just $ padFullText fullLength' . padShortText shortLength' $ block
autoPadding' fullLength' shortLength'
Nothing -> do
yield Nothing
autoPadding' 0 0
padString :: Int64 -> BlockText padString :: Int64 -> BlockText
padString len = normalText . T.take len . T.repeat $ ' ' padString len = normalText . T.take len . T.repeat $ ' '
padFullText :: Int64 -> BlockOutput -> BlockOutput padFullText :: Int64 -> BlockOutput -> BlockOutput
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment