1{-# LANGUAGE OverloadedStrings #-}
2module Reporting.Region where
4import Data.Aeson ((.=))
5import qualified Data.Aeson as Json
6import qualified Text.Parsec.Pos as Parsec
19 { line :: {-# UNPACK #-} !Int
20 , column :: {-# UNPACK #-} !Int
25fromSourcePos :: Parsec.SourcePos -> Position
26fromSourcePos sourcePos =
28 (Parsec.sourceLine sourcePos)
29 (Parsec.sourceColumn sourcePos)
32merge :: Region -> Region -> Region
33merge (Region start _) (Region _ end) =
41toString :: Region -> String
42toString (Region (Position startLine startColumn) (Position endLine endColumn)) =
43 case startLine == endLine of
45 "between lines " ++ show startLine
46 ++ " and " ++ show endLine
49 "on line " ++ show endLine ++ ", column "
50 ++ show startColumn ++ " to " ++ show endColumn
57instance Json.ToJSON Region where
58 toJSON (Region start end) =
65instance Json.ToJSON Position where
66 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