When SynEdit does not contain any text, a call to SynEdit1.RowColToCharIndex(SynEdit1.CaretXY) returns -2. It is expected to return 0. One possible fix is to replace this line
RowCol.Line := Min(Lines.Count, RowCol.Line) - 1;
with this one:
RowCol.Line := Max(0, Min(Lines.Count, RowCol.Line) - 1);
Alex
I moved SynEdit to https://github.com/TurboPack/SynEdit and fixed the bug there.