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
$ docLines
$ [ docSeq (patPartInline ++ [guardPart, return binderDoc])
, docEnsureIndent BrIndentRegular
$ docNonBottomSpacing
, docNonBottomSpacing
$ docEnsureIndent BrIndentRegular
$ docAddBaseY BrIndentRegular
$ return body
]

View File

@ -601,13 +601,14 @@ layoutExpr lexpr@(L _ expr) = do
-- in
-- fooooooooooooooooooo
let noHangingBinds =
[ docAddBaseY BrIndentRegular
[ docNonBottomSpacing $ docAddBaseY BrIndentRegular
$ docPar
(docLit $ Text.pack "let")
(docSetBaseAndIndent $ docLines bindDocs)
, docSeq
[ docLit $ Text.pack "in "
, docAddBaseY BrIndentRegular expDoc1
, docAddBaseY BrIndentRegular
$ docForceParSpacing expDoc1
]
]
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
-- be inserted anywhere but at the start of the line. A
-- 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
$ sequence
$ reverse
@ -745,7 +745,8 @@ getSpacings limit bridoc = preFilterLimit <$> rec bridoc
return $ if null mVs
then [VerticalSpacing 0 (VerticalSpacingParAlways colMax) False]
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
VerticalSpacingParAlways i -> VerticalSpacingParAlways i
VerticalSpacingParSome i -> VerticalSpacingParAlways i