Returns the current TextLocation fron the AvalonEdit control:
int offset = editorInput.AvalonEditor.CaretOffset; TextLocation loc = editorInput.AvalonEditor.Document.GetLocation(offset);