1{-# LANGUAGE FlexibleInstances #-}
2module Reporting.PrettyPrint where
4import Text.PrettyPrint as P
5import qualified AST.Helpers as Help
9 pretty :: Bool -> a -> Doc
12instance Pretty String where
17commaCat :: [Doc] -> Doc
19 cat (punctuate comma docs)
22commaSep :: [Doc] -> Doc
24 sep (punctuate comma docs)
27parensIf :: Bool -> Doc -> Doc
29 if bool then parens doc else doc
32variable :: String -> Doc
34 if Help.isOp x then parens (text x) else text x
37eightyCharLines :: Int -> String -> String
38eightyCharLines indent message = answer
40 (answer,_,_) = foldl step (spaces, indent-1, "") chunks
42 chunks = map (\w -> (w, length w)) (words message)
43 spaces = replicate indent ' '
44 step (sentence, slen, space) (word, wlen)
45 | slen + wlen > 79 = (sentence ++ "\n" ++ spaces ++ word, indent + wlen, " ")
46 | otherwise = (sentence ++ space ++ word, slen + wlen + length space, " ")
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list