i see. Well the answer is obvious now I will just keep the cumulative char count myself! Since the lines come up consecutively. Then just
SelectedColor.Background := clYellow;
SelectedColor.Foreground := clBlack;
SelStart := StartPos;
SelEnd := EndPos;
StartPos/EndPos are points (x/y) too. So where to you need the Position in the text?
Also, note that SynEdit does NOT keep the original LineEnding. So if your text does have LineEndings that differ from the default for the OS, then RowColToCharIndex gives the wrong result.
Of course in your own code you may be able to correct for that.
Still, I don't see where you need the "CharIndex"?
Do you read a 2nd copy of the text from a file?
If so, then maybe go the opposite way, while you read the file, notice and count the LineEndings that you passed (the y pos). Keep the CharIndex of the last LineEnding, so you can get the diff to the current pos (and use that as the x pos).
But anyway, yes keeping counting (cumulative) will solve the speed issue.
Besides, in your case you are running only ONE count for each user input (each step instruction by the user). So that won't get you into to much trouble.
Some people used that in search/replace or similar, running hundreds of calls to RowColToCharIndex for a single user command. And then a 1000 lines of text multiplied by several hundred invocations....