1{-# LANGUAGE OverloadedStrings #-}
2module Reporting.Region where
4import Data.Aeson ((.=))
5import qualified Data.Aeson as Json
6import qualified Text.Parsec.Pos as Parsec
16data Position = Position
23fromSourcePos :: Parsec.SourcePos -> Position
24fromSourcePos sourcePos =
26 (Parsec.sourceLine sourcePos)
27 (Parsec.sourceColumn sourcePos)
30merge :: Region -> Region -> Region
31merge (Region start _) (Region _ end) =
37toString :: Region -> String
38toString (Region start end) =
39 case line start == line end of
41 "between lines " ++ show (line start)
42 ++ " and " ++ show (line end)
45 "on line " ++ show (line end) ++ ", column "
46 ++ show (column start) ++ " to " ++ show (column end)
51instance Json.ToJSON Region where
52 toJSON (Region start end) =
59instance Json.ToJSON Position where
60 toJSON (Position line column) =
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