aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Issue.hs')
-rw-r--r--app/Issue.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/app/Issue.hs b/app/Issue.hs
index 83e7141..9ae3de8 100644
--- a/app/Issue.hs
+++ b/app/Issue.hs
@@ -10,6 +10,7 @@ module Issue
where
import CMark qualified as D
+import Comment qualified as G
import Data.Binary (Binary (..))
import Data.List.NonEmpty (NonEmpty)
import Data.Text qualified as T
@@ -21,8 +22,6 @@ import Git (Author (..), Commit (..))
import Issue.Provenance (Provenance (..))
import Issue.Tag (Tag (..))
import Render qualified as P
-import TreeGrepper.Comment qualified as G
-import TreeGrepper.Match qualified as G
import Prelude hiding (id)
data Issue = Issue
@@ -30,8 +29,8 @@ data Issue = Issue
description :: Maybe (NonEmpty D.Node),
file :: String,
provenance :: Provenance,
- start :: G.Position,
- end :: G.Position,
+ startPoint :: G.Point,
+ endPoint :: G.Point,
tags :: [Tag],
markers :: [T.Text],
rawText :: T.Text,
@@ -78,12 +77,12 @@ replaceText :: Issue -> T.Text -> IO ()
replaceText issue s' = T.writeFile issue.file . replace (indent (comment s')) =<< T.readFile issue.file
where
comment = T.intercalate "\n" . map T.strip . T.lines . G.comment issue.commentStyle
- indent = T.intercalate "\n" . mapButFirst (T.replicate (issue.start.column - 1) " " <>) . T.lines
+ indent = T.intercalate "\n" . mapButFirst (T.replicate (issue.startPoint.column - 1) " " <>) . T.lines
replace s t = before <> s <> after
where
t' = T.lines t
- before = T.intercalate "\n" (mapLast (T.take (issue.start.column - 1)) (take issue.start.row t'))
- after = T.unlines (mapFirst (T.drop issue.end.column) (drop (issue.end.row - 1) t'))
+ before = T.intercalate "\n" (mapLast (T.take (issue.startPoint.column - 1)) (take issue.startPoint.row t'))
+ after = T.unlines (mapFirst (T.drop issue.endPoint.column) (drop (issue.endPoint.row - 1) t'))
mapFirst _ [] = []
mapFirst f (x : xs) = f x : xs
mapLast _ [] = []