// // Returns a ustring with the text in the selected // region. // ustring GetRegion() { long start, end; GetEncodedRegionBounds(out start, out end); int startRow = (int)(start >> 32); var maxrow = ((int)(end >> 32)); int startCol = (int)(start & 0xffffffff); var endCol = (int)(end & 0xffffffff); var line = model.GetLine(startRow); if (startRow == maxrow) { return(StringFromRunes(line.GetRange(startCol, endCol))); } ustring res = StringFromRunes(line.GetRange(startCol, line.Count - startCol)); for (int row = startRow + 1; row < maxrow; row++) { res = res + ustring.Make((Rune)10) + StringFromRunes(model.GetLine(row)); } line = model.GetLine(maxrow); res = res + ustring.Make((Rune)10) + StringFromRunes(line.GetRange(0, endCol)); return(res); }
/// <summary> /// Positions the cursor on the current row and column /// </summary> public override void PositionCursor() { if (selecting) { var minRow = Math.Min(Math.Max(Math.Min(selectionStartRow, currentRow) - topRow, 0), Frame.Height); var maxRow = Math.Min(Math.Max(Math.Max(selectionStartRow, currentRow) - topRow, 0), Frame.Height); SetNeedsDisplay(new Rect(0, minRow, Frame.Width, maxRow)); } var line = model.GetLine(currentRow); var retreat = 0; if (line.Count > 0) { retreat = Math.Max((SpecialRune(line [Math.Max(CurrentColumn - leftColumn - 1, 0)]) ? 1 : 0), 0); } Move(CurrentColumn - leftColumn - retreat, CurrentRow - topRow); }