From fca464e951319b26302957b8db668e6ca84a7152 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 21 Apr 2024 22:48:11 +0200 Subject: [PATCH] SynEdit: fix MarksGutter deduplication --- components/synedit/synguttermarks.pp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/synedit/synguttermarks.pp b/components/synedit/synguttermarks.pp index 9f6cad6ab0..f8f5b6911b 100644 --- a/components/synedit/synguttermarks.pp +++ b/components/synedit/synguttermarks.pp @@ -191,14 +191,23 @@ begin if (FOptions * [sgmoDeDuplicateMarks, sgmoDeDuplicateMarksKeepTwo] <> []) or ((sgmoDeDuplicateMarksOnOverflow in FOptions) and (vcnt > ColumnCount)) then begin - VCntU := 1; + VCntU := 0; VCnt2 := 0; - for j := 1 to MLine.Count - 1 do - if MLine[j].ImageIndex <> MLine[j-1].ImageIndex then + prev_iidx := low(integer); + pprev_iidx := low(integer); + for j := 0 to MLine.Count - 1 do begin + if (not MLine[j].Visible) or + (MLine[j].IsBookmark and (not FBookMarkOpt.GlyphsVisible)) + then + continue; + if MLine[j].ImageIndex <> prev_iidx then inc(VCntU) // Uniq else - if (j=1) or (MLine[j].ImageIndex <> MLine[j-2].ImageIndex) then + if (j=1) or (MLine[j].ImageIndex <> pprev_iidx) then inc(VCnt2); // sgmoDeDuplicateMarksKeepTwo + pprev_iidx := prev_iidx; + prev_iidx := MLine[j].ImageIndex; + end; if (sgmoDeDuplicateMarks in FOptions) then begin vcnt := Min(vcntU, ColumnCount + MaxExtraMarksColums);