public static LogicalDirection RelativeTo(this TextPointer current, TextPointer other) { if (current.IsBefore(other)) { return(LogicalDirection.Backward); } if (current.IsAfter(other)) { return(LogicalDirection.Forward); } return(LogicalDirection.Forward); }