Ejemplo n.º 1
0
 public static void PageDown(TextEditorData data)
 {
     using (var undo = data.OpenUndoGroup()) {
         int pageLines  = (int)((data.VAdjustment.PageSize + ((int)data.VAdjustment.Value % data.LineHeight)) / data.LineHeight);
         int visualLine = data.LogicalToVisualLine(data.Caret.Line);
         visualLine += pageLines;
         int line   = System.Math.Min(data.VisualToLogicalLine(visualLine), data.Document.LineCount);
         int offset = data.Document.LocationToOffset(line, data.Caret.Column);
         ScrollActions.PageDown(data);
         data.Caret.Offset = MoveCaretOutOfFolding(data, offset);
     }
 }
        public static void PageUp(TextEditorData data)
        {
            int pageLines  = (int)((data.VAdjustment.PageSize + ((int)data.VAdjustment.Value % data.LineHeight)) / data.LineHeight);
            int visualLine = data.LogicalToVisualLine(data.Caret.Line);

            visualLine -= pageLines;
            int line   = System.Math.Max(data.VisualToLogicalLine(visualLine), DocumentLocation.MinLine);
            int offset = data.LocationToOffset(line, data.Caret.Column);

            ScrollActions.PageUp(data);
            data.Caret.Offset = MoveCaretOutOfFolding(data, offset);
        }