@@ -85,7 +85,8 @@ data OutputMode = RawOutput | IdeSlave Integer deriving Show
8585
8686-- | How wide is the console?
8787data ConsoleWidth = InfinitelyWide -- ^ Have pretty-printer assume that lines should not be broken
88− | ColsWide Int -- ^ Must be positive
88+ | ColsWide Int -- ^ Manually specified - must be positive
89+ | AutomaticWidth -- ^ Attempt to determine width, or 80 otherwise
8990
9091-- TODO: Add 'module data' to IState, which can be saved out and reloaded quickly (i.e
9192-- without typechecking).
@@ -219,7 +220,7 @@ idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
219220 [] [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] [] []
220221 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
221222 True defaultTheme stdout [] (0, emptyContext) emptyContext M.empty
222− (ColsWide 80)
223+ AutomaticWidth
223224
224225-- | The monad for the main REPL - reading and processing files and updating
225226-- global state (hence the IO inner monad).
@@ -283,6 +284,7 @@ data Command = Quit
283284 | ColourOn
284285 | ColourOff
285286 | ListErrorHandlers
287+ | SetConsoleWidth ConsoleWidth
286288
287289data Opt = Filename String
288290 | Ver
@@ -330,6 +332,7 @@ data Opt = Filename String
330332 | OptLevel Word
331333 | Client String
332334 | ShowOrigErr
335+ | AutoWidth -- ^ Automatically adjust terminal width
333336 deriving (Show, Eq)
334337
335338-- Parsed declarations
@@ -1208,6 +1211,8 @@ pprintPTerm impl bnd = prettySe 10 bnd
12081211
12091212 slist' p bnd (PApp _ (PRef _ nil) _)
12101213 | not impl && nsroot nil == sUN "Nil" = Just []
1214+ slist' p bnd (PRef _ nil)
1215+ | not impl && nsroot nil == sUN "Nil" = Just []
12111216 slist' p bnd (PApp _ (PRef _ cons) args)
12121217 | nsroot cons == sUN "::",
12131218 (PExp {getTm=tl}):(PExp {getTm=hd}):imps <- reverse args,
@@ -1217,14 +1222,16 @@ pprintPTerm impl bnd = prettySe 10 bnd
12171222 where
12181223 isImp (PImp {}) = True
12191224 isImp _ = False
1220− slist' _ _ _ = Nothing
1225+ slist' _ _ tm = Nothing
12211226
12221227 slist p bnd e | Just es <- slist' p bnd e = Just $
12231228 case es of [] -> annotate AnnConstData $ text "[]"
1224− [x] -> enclose left
1225− right
1226− (prettySe p bnd x)
1227− xs -> (enclose left right . hsep . punctuate comma . map (prettySe p bnd)) xs
1229+ [x] -> enclose left right . group $
1230+ prettySe p bnd x
1231+ xs -> (enclose left right .
1232+ align . group . vsep .
1233+ punctuate comma .
1234+ map (prettySe p bnd)) xs
12281235 where left = (annotate AnnConstData (text "["))
12291236 right = (annotate AnnConstData (text "]"))
12301237 comma = (annotate AnnConstData (text ","))