diff --git a/src/QBar/Core.hs b/src/QBar/Core.hs index 310c5c37ee9ee00f38008e0fc6cb1777469ae419..7e6687e2d5b3f5c4f81c31af7d0cf84e759113a8 100644 --- a/src/QBar/Core.hs +++ b/src/QBar/Core.hs @@ -110,16 +110,21 @@ modify :: (BlockOutput -> BlockOutput) -> Pipe (Maybe BlockOutput) (Maybe BlockOutput) BarIO r modify x = PP.map (x <$>) -autoPadding :: Pipe BlockOutput BlockOutput BarIO r +autoPadding :: Pipe (Maybe BlockOutput) (Maybe BlockOutput) BarIO r autoPadding = autoPadding' 0 0 where - autoPadding' :: Int64 -> Int64 -> Pipe BlockOutput BlockOutput BarIO r + autoPadding' :: Int64 -> Int64 -> Pipe (Maybe BlockOutput) (Maybe BlockOutput) BarIO r autoPadding' fullLength shortLength = do - block <- await - let fullLength' = max fullLength . printedLength $ block^.fullText - let shortLength' = max shortLength . printedLength $ block^.shortText._Just -- TODO: ??? - yield $ padFullText fullLength' . padShortText shortLength' $ block - autoPadding' fullLength' shortLength' + maybeBlock <- await + case maybeBlock of + Just block -> do + let fullLength' = max fullLength . printedLength $ block^.fullText + 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 len = normalText . T.take len . T.repeat $ ' ' padFullText :: Int64 -> BlockOutput -> BlockOutput