diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-08-09 20:58:17 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-08-09 21:03:54 +0200 |
commit | 155adcb223576a1548d22d7be1f5b1e29581254d (patch) | |
tree | c51cd9291fe4b74aa7252cff3e5529aeebd81e0c /examples/apps | |
parent | faf7b9f9db5881a2b604e8d9174775bb0ebd8709 (diff) | |
download | fpGUI-155adcb223576a1548d22d7be1f5b1e29581254d.tar.xz |
ide: improves syntax highlighting even more
- multiple matches in the same line are now supported
- regex reserved keyword matching is now case-insensitive
Diffstat (limited to 'examples/apps')
-rw-r--r-- | examples/apps/ide/src/frm_main.pas | 22 |
1 files changed, 11 insertions, 11 deletions
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 } |