Fix EnsureIndent handling

pull/1/head
Lennart Spitzner 2016-08-06 14:01:38 +02:00
parent 449d4b4787
commit 02ee54f806
1 changed files with 23 additions and 6 deletions

View File

@ -405,8 +405,25 @@ transformAlts briDoc
} }
rec x rec x
return $ reWrap $ BDFLines (l':lr') return $ reWrap $ BDFLines (l':lr')
BDFEnsureIndent indent bd -> BDFEnsureIndent indent bd -> do
reWrap . BDFEnsureIndent indent <$> rec bd acp <- mGet
indAmount <- mAsk <&> _conf_layout .> _lconfig_indentAmount .> runIdentity
let indAdd = case indent of
BrIndentNone -> 0
BrIndentRegular -> indAmount
BrIndentSpecial i -> i
mSet $ acp { _acp_indentPrep = 0 -- TODO: i am not sure this is valid,
-- in general.
, _acp_indent = _acp_indent acp + indAdd
, _acp_line = _acp_line acp + indAdd
}
r <- rec bd
acp' <- mGet
mSet $ acp' { _acp_indent = _acp_indent acp }
return $ case indent of
BrIndentNone -> r
BrIndentRegular -> reWrap $ BDFEnsureIndent (BrIndentSpecial indAdd) r
BrIndentSpecial i -> reWrap $ BDFEnsureIndent (BrIndentSpecial i) r
BDFNonBottomSpacing bd -> rec bd BDFNonBottomSpacing bd -> rec bd
BDFSetParSpacing bd -> rec bd BDFSetParSpacing bd -> rec bd
BDFForceParSpacing bd -> rec bd BDFForceParSpacing bd -> rec bd
@ -963,8 +980,8 @@ transformSimplifyFloating = stepBO .> stepFull
-- Just $ BDCols sig (BDEnsureIndent indent col : (BDAddBaseY indent <$> colr)) -- Just $ BDCols sig (BDEnsureIndent indent col : (BDAddBaseY indent <$> colr))
-- not sure if the following rule is necessary; tests currently are -- not sure if the following rule is necessary; tests currently are
-- unaffected. -- unaffected.
BDEnsureIndent indent (BDLines lines) -> -- BDEnsureIndent indent (BDLines lines) ->
Just $ BDLines $ BDEnsureIndent indent <$> lines -- Just $ BDLines $ BDEnsureIndent indent <$> lines
-- post floating in -- post floating in
BDAnnotationPost annKey1 (BDPar ind line indented) -> BDAnnotationPost annKey1 (BDPar ind line indented) ->
Just $ BDPar ind line $ BDAnnotationPost annKey1 indented Just $ BDPar ind line $ BDAnnotationPost annKey1 indented
@ -1048,8 +1065,8 @@ transformSimplifyColumns = Uniplate.rewrite $ \case
-- ensureIndent float-in -- ensureIndent float-in
-- not sure if the following rule is necessary; tests currently are -- not sure if the following rule is necessary; tests currently are
-- unaffected. -- unaffected.
BDEnsureIndent indent (BDLines lines) -> -- BDEnsureIndent indent (BDLines lines) ->
Just $ BDLines $ BDEnsureIndent indent <$> lines -- Just $ BDLines $ BDEnsureIndent indent <$> lines
-- matching col special transformation -- matching col special transformation
BDCols sig1 cols1@(_:_) BDCols sig1 cols1@(_:_)
| BDLines lines@(_:_:_) <- List.last cols1 | BDLines lines@(_:_:_) <- List.last cols1