@@ -407,6 +407,21 @@ getUndefined :: Idris [Name]
407407getUndefined = do i <- getIState
408408 return (map fst (idris_metavars i) \\ primDefs)
409409
410+getWidth :: Idris ConsoleWidth
411+getWidth = fmap idris_consolewidth getIState
412+
413+setWidth :: ConsoleWidth -> Idris ()
414+setWidth w = do ist <- getIState
415+ put ist { idris_consolewidth = w }
416+
417+iRender :: Doc a -> Idris (SimpleDoc a)
418+iRender d = do w <- getWidth
419+ return $ case w of
420+ InfinitelyWide -> renderCompact d
421+ ColsWide n -> if n < 1
422+ then renderCompact d
423+ else renderPretty 0.5 n d
424+
410425ihPrintResult :: Handle -> String -> Idris ()
411426ihPrintResult h s = do i <- getIState
412427 case idris_outputmode i of
@@ -420,9 +435,11 @@ ihPrintResult h s = do i <- getIState
420435-- | Write a pretty-printed term to the console with semantic coloring
421436consoleDisplayAnnotated :: Handle -> Doc OutputAnnotation -> Idris ()
422437consoleDisplayAnnotated h output = do ist <- getIState
438+ rendered <- iRender $ output
423439 runIO . hPutStrLn h .
424− displayDecorated (consoleDecorate ist) .
425− renderCompact $ output
440+ displayDecorated (consoleDecorate ist) $
441+ rendered
442+
426443
427444-- | Write pretty-printed output to IDESlave with semantic annotations
428445ideSlaveReturnAnnotated :: Integer -> Handle -> Doc OutputAnnotation -> Idris ()
@@ -451,7 +468,7 @@ ihPrintFunTypes h n overloads = do imp <- impShow
451468 RawOutput -> consoleDisplayAnnotated h output
452469 IdeSlave n -> ideSlaveReturnAnnotated n h output
453470 where fullName n = annotate (AnnName n Nothing Nothing) $ text (show n)
454− ppOverload imp n tm = fullName n <+> colon <+> prettyImp imp tm
471+ ppOverload imp n tm = fullName n <+> colon <+> align (prettyImp imp tm)
455472
456473fancifyAnnots :: IState -> OutputAnnotation -> OutputAnnotation
457474fancifyAnnots ist annot@(AnnName n _ _) =