Is this where I can post about using AvalonEdit in another application? I apologize if not.
I am using it in TheSeeker, find and replace tool. It's a small utility.
I cannot get the edititor to scroll to the right line when opening up a file to go to the right line of selected code. The scrolling seems to go about 20 to 30 percent too far.
Scrolling to 500 actually goes to 660. 1000 goes to 1300 and so on...
Code:
// textEditor is ICSharpCode.AvalonEdit.TextEditor Just refreshed the code yesterday
textEditor.ScrollToHome();
// position is accurate - verified
ICSharpCode.AvalonEdit.Document.DocumentLine line = textEditor.Document.GetLineByOffset(position);
// when I debug this it's always accurate
parentSeekerWindow.debugDelegate("Line: " + line.LineNumber.ToString() );
textEditor.Select(position, length); // works great
textEditor.ScrollToLine(line.LineNumber);
It doesn't work at all without the scrollToHome() first. I see in the code hint for ScrollToLine() :
Scrolls to the specified line. This method requires that the TextEditor
was already assigned a size (WPF layout must have run prior).
I have set a size. I have not done WPF layout.
Thanks to anyone that can help,
Tom