From 155adcb223576a1548d22d7be1f5b1e29581254d Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 9 Aug 2011 20:58:17 +0200 Subject: ide: improves syntax highlighting even more - multiple matches in the same line are now supported - regex reserved keyword matching is now case-insensitive --- examples/apps/ide/src/frm_main.pas | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'examples/apps/ide/src') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 9255e61e..ccfcebba 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -660,19 +660,19 @@ begin newfont := fpgGetFont(edt.FontDesc + ':bold'); ACanvas.Font := newfont; FRegex.Expression := cKeywords; + FRegex.ModifierI := True; if FRegex.Exec(ALineText) then begin - for i := 1 to FRegex.SubExprMatchCount do - begin - lMatchPos := FRegex.MatchPos[i]; - lOffset := FRegex.MatchLen[i]; - s := FRegex.Match[i]; - j := Length(s); - r.SetRect(ATextRect.Left + (edt.FontWidth * (lMatchPos-1)), ATextRect.Top, - (edt.FontWidth * j), ATextRect.Height); - ACanvas.FillRectangle(r); - ACanvas.DrawText(r, s); - end; + repeat { process results } + lMatchPos := FRegex.MatchPos[1]; + lOffset := FRegex.MatchLen[1]; + s := FRegex.Match[1]; + j := Length(s); + r.SetRect(ATextRect.Left + (edt.FontWidth * (lMatchPos-1)), ATextRect.Top, + (edt.FontWidth * j), ATextRect.Height); + ACanvas.FillRectangle(r); + ACanvas.DrawText(r, s); + until not FRegex.ExecNext; end; { syntax highlighting for: comments } -- cgit v1.2.3-70-g09d2