internal IDiffLineViewModel GotoTextLine(int thisLine) { DocumentLine line = Document.GetLineByNumber(thisLine); TxtControl.SelectText(line.Offset, 0); // Select text with length 0 and scroll to where TxtControl.ScrollToLine(thisLine); // we are supposed to be at return(_DocLineDiffs[thisLine - 1]); }
/// <summary> /// Scrolls the attached view to line <paramref name="n"/> /// where n should in the range of [1 ... max lines]. /// </summary> /// <param name="n"></param> /// <param name="positionCursor"></param> public void ScrollToLine(int n, bool positionCursor) { DocumentLine line = Document.GetLineByNumber(n); if (positionCursor == true) // Position caret with { TxtControl.SelectText(line.Offset, 0); // Text Selection length 0 and scroll to where } TxtControl.ScrollToLine(n); // we are supposed to be at }
/// <summary> /// Selects the specified portion of Text and scrolls that part into view. /// </summary> /// <param name="start"></param> /// <param name="length"></param> public void Select(int start, int length) { TxtControl?.SelectText(start, length); }