Make non-bottom-spacing affect sameline, too (fixes #144)

pull/153/head
Lennart Spitzner 2018-05-16 21:19:36 +02:00
parent 1cab9be7ed
commit f75127b3a5
3 changed files with 8 additions and 6 deletions

View File

@ -421,8 +421,8 @@ layoutPatternBindFinal alignmentToken binderDoc mPatDoc clauseDocs mWhereDocs ha
addAlternative addAlternative
$ docLines $ docLines
$ [ docSeq (patPartInline ++ [guardPart, return binderDoc]) $ [ docSeq (patPartInline ++ [guardPart, return binderDoc])
, docEnsureIndent BrIndentRegular , docNonBottomSpacing
$ docNonBottomSpacing $ docEnsureIndent BrIndentRegular
$ docAddBaseY BrIndentRegular $ docAddBaseY BrIndentRegular
$ return body $ return body
] ]

View File

@ -601,13 +601,14 @@ layoutExpr lexpr@(L _ expr) = do
-- in -- in
-- fooooooooooooooooooo -- fooooooooooooooooooo
let noHangingBinds = let noHangingBinds =
[ docAddBaseY BrIndentRegular [ docNonBottomSpacing $ docAddBaseY BrIndentRegular
$ docPar $ docPar
(docLit $ Text.pack "let") (docLit $ Text.pack "let")
(docSetBaseAndIndent $ docLines bindDocs) (docSetBaseAndIndent $ docLines bindDocs)
, docSeq , docSeq
[ docLit $ Text.pack "in " [ docLit $ Text.pack "in "
, docAddBaseY BrIndentRegular expDoc1 , docAddBaseY BrIndentRegular
$ docForceParSpacing expDoc1
] ]
] ]
addAlternative $ case indentPolicy of addAlternative $ case indentPolicy of

View File

@ -707,7 +707,7 @@ getSpacings limit bridoc = preFilterLimit <$> rec bridoc
-- paragraph". That most importantly means that Lines should never -- paragraph". That most importantly means that Lines should never
-- be inserted anywhere but at the start of the line. A -- be inserted anywhere but at the start of the line. A
-- counterexample would be anything like Seq[Lit "foo", Lines]. -- counterexample would be anything like Seq[Lit "foo", Lines].
lSpss <- fmap filterAndLimit <$> rec `mapM` ls lSpss <- map filterAndLimit <$> rec `mapM` ls
let worbled = fmap reverse let worbled = fmap reverse
$ sequence $ sequence
$ reverse $ reverse
@ -745,7 +745,8 @@ getSpacings limit bridoc = preFilterLimit <$> rec bridoc
return $ if null mVs return $ if null mVs
then [VerticalSpacing 0 (VerticalSpacingParAlways colMax) False] then [VerticalSpacing 0 (VerticalSpacingParAlways colMax) False]
else mVs <&> \vs -> vs else mVs <&> \vs -> vs
{ _vs_paragraph = case _vs_paragraph vs of { _vs_sameLine = min colMax (_vs_sameLine vs)
, _vs_paragraph = case _vs_paragraph vs of
VerticalSpacingParNone -> VerticalSpacingParNone VerticalSpacingParNone -> VerticalSpacingParNone
VerticalSpacingParAlways i -> VerticalSpacingParAlways i VerticalSpacingParAlways i -> VerticalSpacingParAlways i
VerticalSpacingParSome i -> VerticalSpacingParAlways i VerticalSpacingParSome i -> VerticalSpacingParAlways i