Behaviour does not depend on type of event that triggers it, nor regex itself. Could be any regex.
procedure TForm1.FormCreate(Sender: TObject);
begin
SynEdit1.SetHighlightSearch('ab',[ssoRegExpr]);
end;
Inside SynEditSearch.pas
ln. 903
if fRegExpr then begin // IF SOMETHING OR MORE OF IT WITHIN ENTIRE TEXT MATCHES GIVEN REGEX
// regular expression
if SearchRegExprInLine(Max(1,x+1),LineStr) then begin
//DebugLn(['TSynEditSearch.FindNextOne Found RegExpr']);
FoundStartPos:=Point(RegExprEngine.MatchPos[0],y+1);
FoundEndPos:=
Point(RegExprEngine.MatchPos[0]+RegExprEngine.MatchLen[0],y+1);
Result:=(CompareCarets(FoundEndPos,EndPos)>=0)
and (CompareCarets(FoundStartPos,StartPos)<=0);
if Result then
fRegExprReplace:=RegExprEngine.Substitute(Replacement);
exit;
end;
end else
Realy guessing here, seems Result indicates that stuff will be painted.
At 'ab' regex:
On empty synedit:
1. 'abcab' Result gets true once and only first 'ab' gets painted
2. 'abcabc' Result gets true twice and both 'ab' gets painted
BTW:
If I put SynEdit on form , run prog, hit CTRL + A & DEL
It does not seem logical that clicking into 'first line - further to right, not 1,1 position' puts caret anywhere I clicked in 'first line'.
Should 'force' it to be on 1,1 position ? That is the way it is in all text editors.
Telling that coz FoundEndPos is realy big sometimes, and that could be original prob. mybe.
Same goes for all lines.
Hit enter at end of line, type one char, and that new line is not 1 char long regarding clicking further to the right in that line.