![Avatar](https://secure.gravatar.com/avatar/0131424e013db2d21d0384fcbab50a71.jpg?s=64&d=identicon&r=g)
I need to be able to get the position of the caret before ANY change occurs in the editor. This could be a regular ITextChange event or in could be undo/redo event. Or it could be something I didn't list because I didn't know about it.
Currently, this is the best I can come up and it works for text changes but NOT undo/redos
private void OnPreviewKeyDown(object sender, KeyEventArgs e)
{
// Capture the caret position before a change occurs
PreChangeCaretPosition = editor.ActiveView.Selection.CaretPosition;
}
private bool IsCaretAtBeginningOfLine => PreChangeCaretPosition.Character == 0;