From 52d9992f19b8ff12d36b26445a2b4b04c127674a Mon Sep 17 00:00:00 2001 From: Daniel Trstenjak Date: Thu, 17 Jul 2014 17:12:30 +0200 Subject: [PATCH 1/3] Fix pretty printing with showFreeText Remove the special casing for strings starting with a newline. Handle all newlines in strings the same way, by replacing them with a '.'. --- Cabal/Distribution/ParseUtils.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/Cabal/Distribution/ParseUtils.hs b/Cabal/Distribution/ParseUtils.hs index 8f6d9ef1a29..ae2ace70c72 100644 --- a/Cabal/Distribution/ParseUtils.hs +++ b/Cabal/Distribution/ParseUtils.hs @@ -733,7 +733,6 @@ showTestedWith (compiler, version) = text (show compiler) <+> disp version -- and with blank lines replaced by dots for correct re-parsing. showFreeText :: String -> Doc showFreeText "" = empty -showFreeText ('\n' :r) = text " " $+$ text "." $+$ showFreeText r showFreeText s = vcat [text (if null l then "." else l) | l <- lines_ s] -- | 'lines_' breaks a string up into a list of strings at newline From f236efd11bfd1af119ff22e66447143d31b8945a Mon Sep 17 00:00:00 2001 From: Daniel Trstenjak Date: Thu, 17 Jul 2014 17:14:45 +0200 Subject: [PATCH 2/3] Pretty print the field 'depends' nested --- Cabal/Distribution/ParseUtils.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Cabal/Distribution/ParseUtils.hs b/Cabal/Distribution/ParseUtils.hs index ae2ace70c72..e507a7a8661 100644 --- a/Cabal/Distribution/ParseUtils.hs +++ b/Cabal/Distribution/ParseUtils.hs @@ -284,6 +284,7 @@ ppField name fielddoc , "includes" , "install-includes" , "other-modules" + , "depends" ] showFields :: [FieldDescr a] -> a -> String From 33f1b71474459bee7ee73d5e71df601b36485547 Mon Sep 17 00:00:00 2001 From: Daniel Trstenjak Date: Thu, 17 Jul 2014 17:15:22 +0200 Subject: [PATCH 3/3] Fix pretty printing of flags Pretty print the fields of flags nested. --- Cabal/Distribution/PackageDescription/PrettyPrint.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cabal/Distribution/PackageDescription/PrettyPrint.hs b/Cabal/Distribution/PackageDescription/PrettyPrint.hs index 482f8dc64d5..6b39628192a 100644 --- a/Cabal/Distribution/PackageDescription/PrettyPrint.hs +++ b/Cabal/Distribution/PackageDescription/PrettyPrint.hs @@ -109,7 +109,7 @@ ppGenPackageFlags flds = vcat [ppFlag f | f <- flds] ppFlag :: Flag -> Doc ppFlag flag@(MkFlag name _ _ _) = - emptyLine $ text "flag" <+> ppFlagName name $+$ fields + emptyLine $ text "flag" <+> ppFlagName name $+$ nest indentWith fields where fields = ppFieldsFiltered flagDefaults flagFieldDescrs flag