From 78af9e0b4a00f1c67ad61ecd000f1068e6710389 Mon Sep 17 00:00:00 2001 From: Yura Taras Date: Thu, 26 Sep 2024 10:56:16 +0300 Subject: [PATCH] Using highlight position percent to sort by location Fix #131 --- src/util.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util.ts b/src/util.ts index 1f1e29d..e5e06a9 100644 --- a/src/util.ts +++ b/src/util.ts @@ -46,6 +46,9 @@ export const getHighlightPoint = (patch: string | null): HighlightPoint => { } export const compareHighlightsInFile = (a: Highlight, b: Highlight): number => { + if (a.highlightPositionPercent != b.highlightPositionPercent) { + return a.highlightPositionPercent - b.highlightPositionPercent; + } // get the position of the highlight in the file const highlightPointA = getHighlightPoint(a.patch) const highlightPointB = getHighlightPoint(b.patch)