I know this is a pretty old question, but I decided to share my solution. I'm not sure if this solution was implemented in AvalonEdit, because this question was answered, but I believe that the OffsetColorizer class does not actually select a line: it just changes the background color of the line.
My solution is this:
textEditor.SelectionStart = offset; textEditor.SelectionLength = length;
However, this can be continued as follows:
public void SelectText(int offset, int length) {
I find that this solution works better, so that instead of just coloring the line, he actually selects it: this means that it can be copied with Ctrl + C.
Hope this helps people in the future.
source share