From 1be10bb6e19cc759fe7942a6aa1b29ea91dfbfcf Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 24 May 2013 10:21:58 +0000 Subject: [PATCH] SynEdit: Ifdef Markup: prevent endless loop git-svn-id: trunk@41384 - --- ide/sourceeditor.pp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index 39f64bcf21..c68438b77b 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -5520,14 +5520,16 @@ begin if SynState=idnInvalid then SynState:=idnDisabled; end; - if i=Scanner.DirectiveCount then break; - ADirective:=Scanner.DirectivesSorted[i]; + if i < Scanner.DirectiveCount then begin + ADirective:=Scanner.DirectivesSorted[i]; + {$IFDEF VerboseUpdateIfDefNodeStates} + if (Pos(VFilePattern,Code.Filename)>0) and (Y>=VMinY) and (Y<=VMaxY) and (ADirective^.SrcPos=SrcPos) then + debugln(['TSourceEditor.UpdateIfDefNodeStates ',i,'/',Scanner.DirectiveCount,' MERGING ',dbgs(ADirective^.Code),' ',Code.Filename,' X=',X,' Y=',Y,' SrcPos=',aDirective^.SrcPos,' State=',dbgs(aDirective^.State)]); + {$ENDIF} + end; inc(i); - {$IFDEF VerboseUpdateIfDefNodeStates} - if (Pos(VFilePattern,Code.Filename)>0) and (Y>=VMinY) and (Y<=VMaxY) and (ADirective^.SrcPos=SrcPos) then - debugln(['TSourceEditor.UpdateIfDefNodeStates ',i,'/',Scanner.DirectiveCount,' MERGING ',dbgs(ADirective^.Code),' ',Code.Filename,' X=',X,' Y=',Y,' SrcPos=',aDirective^.SrcPos,' State=',dbgs(aDirective^.State)]); - {$ENDIF} - until (ADirective^.SrcPos<>SrcPos) or (TCodeBuffer(ADirective^.Code)<>Code); + until (ADirective^.SrcPos<>SrcPos) or (TCodeBuffer(ADirective^.Code)<>Code) + or (i > Scanner.DirectiveCount); dec(i); {$IFDEF VerboseUpdateIfDefNodeStates} if (Pos(VFilePattern,Code.Filename)>0) and (Y>=VMinY) and (Y<=VMaxY) then