Fix multiline-list indentation past comma level

ghc92
Lennart Spitzner 2023-06-20 11:50:58 +02:00
parent 278e0275f2
commit a6e187e962
4 changed files with 52 additions and 45 deletions

View File

@ -21,3 +21,10 @@ foo =
, 4
, 5
]
#test set-base-y for multiple line elements
foo =
[ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
, bbbbbbbbbbbbbbbbbb
$ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
]

View File

@ -215,13 +215,13 @@ showPackageDetailedInfo pkginfo =
(altText null "[ Not available from server ]")
(dispTopVersions 9 (preferredVersions pkginfo))
, entry
"Versions installed"
installedVersions
(altText
null
(if hasLib pkginfo then "[ Not installed ]" else "[ Unknown ]")
)
(dispTopVersions 4 (preferredVersions pkginfo))
"Versions installed"
installedVersions
(altText
null
(if hasLib pkginfo then "[ Not installed ]" else "[ Unknown ]")
)
(dispTopVersions 4 (preferredVersions pkginfo))
, entry "Homepage" homepage orNotSpecified text
, entry "Bug reports" bugReports orNotSpecified text
, entry "Description" description hideIfNull reflowParagraphs
@ -236,10 +236,10 @@ showPackageDetailedInfo pkginfo =
, entry "Documentation" haddockHtml showIfInstalled text
, entry "Cached" haveTarball alwaysShow dispYesNo
, if not (hasLib pkginfo)
then empty
else
text "Modules:"
$+$ nest 4 (vcat (map disp . sort . modules $ pkginfo))
then empty
else
text "Modules:"
$+$ nest 4 (vcat (map disp . sort . modules $ pkginfo))
]
#test issue 7a
@ -413,10 +413,10 @@ layoutPatternBindFinal alignmentToken binderDoc mPatDoc clauseDocs = do
(ColBindingLine alignmentToken)
[ docSeq (patPartInline ++ [guardPart])
, docSeq
[ appSep $ return binderDoc
, docForceSingleline $ return body
, wherePart
]
[ appSep $ return binderDoc
, docForceSingleline $ return body
, wherePart
]
]
| not hasComments
, [(guards, body, _bodyRaw)] <- [clauseDocs]
@ -436,7 +436,7 @@ layoutPatternBindFinal alignmentToken binderDoc mPatDoc clauseDocs = do
(ColBindingLine alignmentToken)
[ docSeq (patPartInline ++ [guardPart])
, docSeq
[appSep $ return binderDoc, docForceParSpacing $ return body]
[appSep $ return binderDoc, docForceParSpacing $ return body]
]
]
++ wherePartMultiLine
@ -447,10 +447,10 @@ layoutPatternBindFinal alignmentToken binderDoc mPatDoc clauseDocs = do
++ -- two-line solution + where in next line(s)
[ docLines
$ [ docForceSingleline $ docSeq
(patPartInline ++ [guardPart, return binderDoc])
(patPartInline ++ [guardPart, return binderDoc])
, docEnsureIndent BrIndentRegular
$ docForceSingleline
$ return body
$ docForceSingleline
$ return body
]
++ wherePartMultiLine
| [(guards, body, _bodyRaw)] <- [clauseDocs]

View File

@ -1149,18 +1149,18 @@ showPackageDetailedInfo pkginfo =
$+$ something
[ entry "Synopsis" synopsis hideIfNull reflowParagraphs
, entry
"Versions available"
sourceVersions
(altText null "[ Not available from server ]")
(dispTopVersions 9 (preferredVersions pkginfo))
"Versions available"
sourceVersions
(altText null "[ Not available from server ]")
(dispTopVersions 9 (preferredVersions pkginfo))
, entry
"Versions installed"
installedVersions
(altText
null
(if hasLib pkginfo then "[ Not installed ]" else "[ Unknown ]")
)
(dispTopVersions 4 (preferredVersions pkginfo))
"Versions installed"
installedVersions
(altText
null
(if hasLib pkginfo then "[ Not installed ]" else "[ Unknown ]")
)
(dispTopVersions 4 (preferredVersions pkginfo))
, entry "Homepage" homepage orNotSpecified text
, entry "Bug reports" bugReports orNotSpecified text
, entry "Description" description hideIfNull reflowParagraphs
@ -1175,10 +1175,10 @@ showPackageDetailedInfo pkginfo =
, entry "Documentation" haddockHtml showIfInstalled text
, entry "Cached" haveTarball alwaysShow dispYesNo
, if not (hasLib pkginfo)
then empty
else
text "Modules:"
$+$ nest 4 (vcat (map disp . sort . modules $ pkginfo))
then empty
else
text "Modules:"
$+$ nest 4 (vcat (map disp . sort . modules $ pkginfo))
]
#test issue 7a
@ -1339,10 +1339,10 @@ layoutPatternBindFinal alignmentToken binderDoc mPatDoc clauseDocs = do
(ColBindingLine alignmentToken)
[ docSeq (patPartInline ++ [guardPart])
, docSeq
[ appSep $ return binderDoc
, docForceSingleline $ return body
, wherePart
]
[ appSep $ return binderDoc
, docForceSingleline $ return body
, wherePart
]
]
| not hasComments
, [(guards, body, _bodyRaw)] <- [clauseDocs]
@ -1362,7 +1362,7 @@ layoutPatternBindFinal alignmentToken binderDoc mPatDoc clauseDocs = do
(ColBindingLine alignmentToken)
[ docSeq (patPartInline ++ [guardPart])
, docSeq
[appSep $ return binderDoc, docForceParSpacing $ return body]
[appSep $ return binderDoc, docForceParSpacing $ return body]
]
]
++ wherePartMultiLine
@ -1373,10 +1373,10 @@ layoutPatternBindFinal alignmentToken binderDoc mPatDoc clauseDocs = do
++ -- two-line solution + where in next line(s)
[ docLines
$ [ docForceSingleline $ docSeq
(patPartInline ++ [guardPart, return binderDoc])
(patPartInline ++ [guardPart, return binderDoc])
, docEnsureIndent BrIndentRegular
$ docForceSingleline
$ return body
$ docForceSingleline
$ return body
]
++ wherePartMultiLine
| [(guards, body, _bodyRaw)] <- [clauseDocs]

View File

@ -736,15 +736,15 @@ layoutExpr lexpr@(L _ expr) = do
, docForceSingleline eN
, closeDoc]
addAlternative
$ let start = docCols ColList [appSep $ openDoc, e1]
$ let start = docCols ColList [appSep $ openDoc, docSetBaseY e1]
linesM = ems <&> \(p, ast, d) ->
docCols
ColList
[ docHandleComms p docCommaSep
, docFlushCommsPost True ast $ d
, docSetBaseY $ docFlushCommsPost True ast $ d
]
lineN = docCols ColList
[docHandleComms finalCommaPos $ docCommaSep, eN]
[docHandleComms finalCommaPos $ docCommaSep, docSetBaseY eN]
in docSetBaseY
$ docLines
$ [start]