From fc8eed3c5aec6757eb3420cf528e80f71a6af37b Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 2 Jun 2015 22:47:30 +0200 Subject: [PATCH] updated range comp proc --- src/ce_d2syn.pas | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ce_d2syn.pas b/src/ce_d2syn.pas index 2c03f0eb..09e3f8cf 100644 --- a/src/ce_d2syn.pas +++ b/src/ce_d2syn.pas @@ -227,6 +227,8 @@ end; function TSynD2SynRange.Compare(Range: TSynCustomHighlighterRange): integer; var src_t: TSynD2SynRange; +const + cmpRes: array[boolean] of integer = (-1, 1); begin result := inherited Compare(Range); if result <> 0 then exit; @@ -234,12 +236,13 @@ begin if Range is TSynD2SynRange then begin src_t := TSynD2SynRange(Range); - if src_t.rangeKinds <> rangeKinds then exit(1); - if src_t.nestedCommentsCount <> nestedCommentsCount then exit(1); - if src_t.tokenStringBracketsCount <> tokenStringBracketsCount then exit(1); - if src_t.rString <> rString then exit(1); - if src_t.namedRegionCount <> namedRegionCount then exit(1); - exit(0); + if (src_t.rString and rString) then exit(0); + if src_t.nestedCommentsCount <> nestedCommentsCount then + exit(cmpRes[src_t.nestedCommentsCount > nestedCommentsCount]); + if src_t.tokenStringBracketsCount <> tokenStringBracketsCount then + exit(cmpRes[src_t.tokenStringBracketsCount > tokenStringBracketsCount]); + if src_t.namedRegionCount <> namedRegionCount then + exit(cmpRes[src_t.namedRegionCount > namedRegionCount]); end; end;