Scroll to Selection in TextArea

I have a Find Previous/Next feature that highlights the found text in a DesktopTextArea. My problem is that it doesn’t bring the newly highlighted text into view.

I have tried the following but, while it moves the view, displays the wrong location on the line. Anyone got a hint?

RawTextEditor.SelectionStart = FoundStart
RawTextEditor.SelectionLength = FindText.Length
RawTextEditor.HorizontalScrollPosition = FoundStart * RawTextEditor.FontSize //needs pixels
RawTextEditor.VerticalScrollPosition = RawTextEditor.LineNumber(FoundStart)

I am having a similar problem.

I find the character position of a TextArea in the MouseDown event with “TextArea.CharacterPosition(x,y)”. Then, after modifying some text at that Character pos and rewriting the modified text into the TextArea, I attempt to scroll back to that original character position using LineNumber(charPos), but instead the vertical scroll position goes to the bottom.

gCharPos = TextArea.CharacterPosition(x,y)
. . . (do some work; update TextArea text)
TextArea.VerticalScrollPosition = TextArea.LineNumber(gCharPos)

… always scrolls to bottom, regardless of where gCharPos is located.