@@ -85,7 +85,8 @@ data OutputMode = RawOutput | IdeSlave Integer deriving Show
86-- | How wide is the console?
86-- | How wide is the console?
87data ConsoleWidth = InfinitelyWide -- ^ Have pretty-printer assume that lines should not be broken
87data 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
90-- TODO: Add 'module data' to IState, which can be saved out and reloaded quickly (i.e
91-- TODO: Add 'module data' to IState, which can be saved out and reloaded quickly (i.e
91-- without typechecking).
92-- without typechecking).
@@ -219,7 +220,7 @@ idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
219 [] [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] [] []
220 [] [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] [] []
220 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
221 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
221 True defaultTheme stdout [] (0, emptyContext) emptyContext M.empty
222 True defaultTheme stdout [] (0, emptyContext) emptyContext M.empty
222− (ColsWide 80)
223+ AutomaticWidth
224-- | The monad for the main REPL - reading and processing files and updating
225-- | The monad for the main REPL - reading and processing files and updating
225-- global state (hence the IO inner monad).
226-- global state (hence the IO inner monad).
@@ -283,6 +284,7 @@ data Command = Quit
283 | ColourOn
284 | ColourOn
284 | ColourOff
285 | ColourOff
285 | ListErrorHandlers
286 | ListErrorHandlers
287+ | SetConsoleWidth ConsoleWidth
287data Opt = Filename String
289data Opt = Filename String
@@ -330,6 +332,7 @@ data Opt = Filename String
330 | OptLevel Word
332 | OptLevel Word
331 | Client String
333 | Client String
332 | ShowOrigErr
334 | ShowOrigErr
335+ | AutoWidth -- ^ Automatically adjust terminal width
333 deriving (Show, Eq)
336 deriving (Show, Eq)
335-- Parsed declarations
338-- Parsed declarations
@@ -1208,6 +1211,8 @@ pprintPTerm impl bnd = prettySe 10 bnd
1209 slist' p bnd (PApp _ (PRef _ nil) _)
1212 slist' p bnd (PApp _ (PRef _ nil) _)
1210 | not impl && nsroot nil == sUN "Nil" = Just []
1213 | not impl && nsroot nil == sUN "Nil" = Just []
1214+ slist' p bnd (PRef _ nil)
1215+ | not impl && nsroot nil == sUN "Nil" = Just []
1211 slist' p bnd (PApp _ (PRef _ cons) args)
1216 slist' p bnd (PApp _ (PRef _ cons) args)
1212 | nsroot cons == sUN "::",
1217 | nsroot cons == sUN "::",
1213 (PExp {getTm=tl}):(PExp {getTm=hd}):imps <- reverse args,
1218 (PExp {getTm=tl}):(PExp {getTm=hd}):imps <- reverse args,
@@ -1217,14 +1222,16 @@ pprintPTerm impl bnd = prettySe 10 bnd
1218 isImp (PImp {}) = True
1223 isImp (PImp {}) = True
1219 isImp _ = False
1224 isImp _ = False
1220− slist' _ _ _ = Nothing
1225+ slist' _ _ tm = Nothing
1222 slist p bnd e | Just es <- slist' p bnd e = Just $
1227 slist p bnd e | Just es <- slist' p bnd e = Just $
1223 case es of [] -> annotate AnnConstData $ text "[]"
1228 case es of [] -> annotate AnnConstData $ text "[]"
1224− [x] -> enclose left
1229+ [x] -> enclose left right . group $
1226− (prettySe p bnd x)
1230+ prettySe p bnd x
1227− xs -> (enclose left right . hsep . punctuate comma . map (prettySe p bnd)) xs
1231+ xs -> (enclose left right .
1232+ align . group . vsep .
1234+ map (prettySe p bnd)) xs
1228 where left = (annotate AnnConstData (text "["))
1235 where left = (annotate AnnConstData (text "["))
1229 right = (annotate AnnConstData (text "]"))
1236 right = (annotate AnnConstData (text "]"))
1230 comma = (annotate AnnConstData (text ","))
1237 comma = (annotate AnnConstData (text ","))