/// <summary> /// Gets a number equal zero if both positions refer to the same location. /// Returns otherwise a non-zero integer value. /// </summary> /// <param name="position"></param> /// <returns></returns> public int CompareTo(IDiffViewPosition position) { int result = this.Line - position.Line; if (result == 0) { result = this.Column - position.Column; } return(result); }
/// <summary> /// Gets whether a the positions is equal to this position or not. /// </summary> /// <param name="value"></param> /// <returns></returns> public bool Equals(IDiffViewPosition value) { if (value == null) { return(false); } if (value.Column != this.Column || value.Line != this.Line) { return(false); } return(true); }
/// <summary> /// Moves both views to the requested line position. /// </summary> /// <param name="gotoPos"></param> /// <param name="viewA"></param> /// <param name="viewB"></param> /// <param name="positionCursor"></param> public void ScrollToLine(IDiffViewPosition gotoPos, IDiffSideViewModel viewA, IDiffSideViewModel viewB, bool positionCursor) { if (viewA != null) { viewA.ScrollToLine(gotoPos.Line + 1, positionCursor); viewA.SetPosition(gotoPos); } if (viewB != null) { viewB.ScrollToLine(gotoPos.Line + 1, positionCursor); viewB.SetPosition(gotoPos); } }
/// <summary> /// (re)Sets the current caret position (column and line) in the text editor view. /// </summary> /// <param name="gotoPos"></param> public void SetPosition(IDiffViewPosition gotoPos) { _position.SetPosition(gotoPos.Line, gotoPos.Column); }