I would like to intercept text as it is input (as the user types, after they've pasted text, etc) and format it as necessary (trim whitespace from the start of any changed lines, change instances of "foo" to "foobar", etc). My AvalonEditor control is called "MainTextEditor".
I tried writing a custom VisualLineElementGenerator this morning, but I need the actual text to change, and it seems to only modify the text that is shown, not the underlying document text - because when I then try to access MainTextEditor.Text, the string it returns does not contain the changes that my VisualLineElementGenerator made.
I assume that's how the VisualLineElementGenerator is supposed to work, and that I need a different solution - but I'm not sure where to go from here...
Thanks for any help you can provide! And if you need more info, just ask :)