private void DrawBorders(System.Windows.Media.DrawingContext dc) { dc.PushClip(new RectangleGeometry(new Rect(0, 0, Width, Height))); int lineNumber = StartLine; if (lineNumber > 0) { lineNumber--; } while (lineNumber > 0 && !REPLData.KindIsGap(LineKinds[lineNumber])) { lineNumber--; } while (true) { double topY = (lineNumber - StartLine) * LineHeight + 2; lineNumber++; while (lineNumber < Lines.Count && !REPLData.KindIsGap(LineKinds[lineNumber])) { lineNumber++; } double bottomY = (lineNumber - StartLine) * LineHeight + 2; dc.DrawRoundedRectangle(InsideBrush, BorderPen, new Rect(SpaceWidth / 2, topY + topOffset, Width - SpaceWidth, bottomY - topY - LineHeight / 3), SpaceWidth, SpaceWidth); if (lineNumber >= Lines.Count - 1 || lineNumber > StartLine + Height / LineHeight) { break; } } ; dc.Pop(); }
protected override void JustifyCursor(ref int line, int previousLine, ref int x, int previousX) { int originalLine = line; int originalX = x; if (line >= LineKinds.Count || REPLData.KindIsGap(LineKinds[line])) { if (previousLine < originalLine) { line++; } else { line--; } if (line >= Lines.Count - 1) { line = Lines.Count - 2; } else if (line < 1) { line = 1; } } if (x < 2) { x = 2; } int originalStartX = StartX; if (x - StartX < 2) { StartX = x - 2; } if (StartX < 0) { StartX = 0; } if (x == 2) { StartX = 0; } if (originalLine != line || originalX != x || originalStartX != StartX) { SendScrolleeInfo(); } }