From 2a30f6d4621c04cecf61288db862cdcab79fa495 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 10 Feb 2017 14:23:42 -0500 Subject: [PATCH] Pre-slice in termToDiffInfo. --- src/Renderer/TOC.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Renderer/TOC.hs b/src/Renderer/TOC.hs index e562b86ef..c5abd9fed 100644 --- a/src/Renderer/TOC.hs +++ b/src/Renderer/TOC.hs @@ -152,9 +152,10 @@ termToDiffInfo source term = case unwrap term of _ -> toLeafInfo term where toTermName' :: SyntaxTerm leaf fields -> Text - toTermName' subterm = toTermName (Source.slice (range subterm) source) subterm + toTermName' subterm = toTermName (Source.slice (subtermRange subterm) source) subterm range = characterRange . extract - termToDiffInfo' = termToDiffInfo source + subtermRange subterm = offsetRange (range subterm) (negate (start (range term))) + termToDiffInfo' subterm = termToDiffInfo (Source.slice (subtermRange subterm) source) subterm toLeafInfo term = LeafInfo (category $ extract term) (toTermName' term) (getField $ extract term) toTermName :: forall leaf fields. DefaultFields fields => Source -> SyntaxTerm leaf fields -> Text