OK, so if anyone wants to run this in a debugger...
synedit.pp line 8670 in
procedure TCustomSynEdit.DoTabKey;
if SelAvail and (not FBlockSelection.Persistent) and (eoOverwriteBlock in fOptions2) then begin
SetSelTextExternal(Spaces);
end
else begin
FCaret.IncAutoMoveOnEdit;
FTheLinesView.EditInsert(FCaret.BytePos, FCaret.LinePos, Spaces);
FCaret.DecAutoMoveOnEdit;
Include(fStateFlags, sfEnsureCursorPosForEditRight);
end;
This is the code that actually inserts the text.
You may want to step into
IncAutoMoveOnEdit
and while in class "TSynEditCaret" watch the value of "FLinePos"
And maybe also...
FLinePos: Integer; // 1 based
FCharPos: Integer; // 1 based
FBytePos, FBytePosOffset: Integer; // 1 based
FViewedLineCharPos: TPoint;
FOldLinePos: Integer; // 1 based
FOldCharPos: Integer; // 1 based
You could set a watchpoint at "FLinePos" => that would give you the exact pos where it will be changed.
If the watchpoint does not work, you want breakpoints at the entry of the following functions:
syneditpointclasses.pas line 1180 TSynEditCaret.DoLinesEdited
syneditpointclasses.pas line 1360 TSynEditCaret.InternalSetLineByterPos
You should enter DoLinesEdited first.
It should calculate the new X pos and call InternalSetLineByterPos with the existing Y and the new X.
Step through InternalSetLineByterPos, and see where the Y gets changed.
The watchpoint will have one major advantage.
If Y is not changed by the code setting the caret pos, but if some other code writes to the wrong memory, and hits the Y pos, then only a watchpoint will get us there.