summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/Main.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 41a546f..479f3b0 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -528,15 +528,16 @@ suggestTags settings probabilityCache doc = do
case suggestedTag of
S.SuggestTagByRE tagName searchReplaces ->
let tagValues =
- nub . concat $
+ nub . map snd . sortBy (comparing fst) . concat $
map
( \searchReplace ->
mapMaybe
( -- XXX Whys is this so complicated?
\match -> do
- captures <- snd <$> R.matchCaptures match
+ (topCapture, captures) <- R.matchCaptures match
pure
- ( foldl
+ ( topCapture.captureOffset,
+ foldl
( \template (captureName, captureOrdinal) ->
T.replace
("${" <> R.getCaptureName captureName <> "}")