Ejemplo n.º 1
0
void EmacsBuffer::setPointLine(mintcount_t line) {
    // FIXME: This could be optimised to move relative to current
    //        point position if this was closer than starting at top.
    if (line > _pointLine) {
        // Trying to move past end?
        if (line >= _countNewlines) {
            _pointLine = _countNewlines;
            _point = getMarkPosition(MARK_BOL, _text.size());
        } else {
            // We just move forward the specified number of lines
            mintcount_t linediff = line - _pointLine;
            while (linediff--) {
                _point = forwardLines(_point, 1);
                ++_pointLine;
            } // while
        } // else
    } else if (line < _pointLine) {
        // Trying to move to top?
        if (line == 0) {
            _pointLine = 0;
            _point = 0;
        } else {
            // We just move backward the specified number of lines
            mintcount_t linediff = _pointLine - line;
            while (linediff--) {
                _point = backwardLines(_point, 1);
                --_pointLine;
            } // while
        } // else
    } // else if
} // setLine
Ejemplo n.º 2
0
void EmacsBuffer::forcePointInWindow(mintcount_t li, mintcount_t co,
                                     mintcount_t tp, mintcount_t bp) {
    mintcount_t tl = li * tp / 100;
    if (_pointLine <= tl) {
        // Inside top margin
        _topline = 0;
        _toplineLine = 0;
    } else {
        mintcount_t bl = li * bp / 100;
        if (_pointLine >= _countNewlines - bl) {
            // Inside bottom margin
            _topline = backwardLines(getMarkPosition(MARK_BOL, _text.size()), li - 1);
            _toplineLine = _countNewlines - (li - 1);
        } else {
            if (_pointLine < (_toplineLine + tl)) {
                // Point is before top margin
                mintcount_t blines = (_toplineLine + tl) - _pointLine;
                _topline = backwardLines(_topline, blines);
                _toplineLine -= blines;
            } else if (_pointLine >= (_toplineLine + (li - bl))) {
                // Point is after bottom margin
                mintcount_t flines = _pointLine - (_toplineLine + (li - bl));
                _topline = forwardLines(_topline, flines);
                _toplineLine += flines;
            } // else if
        } // else
    } // else

    // Now the point line is in the window.  Do the same for point column.
    mintcount_t point_column = countColumns(getMarkPosition(MARK_BOL, _point), _point);
    if (point_column < _leftcol) {
        // point is off the left edge of the screen
        _leftcol = (point_column / _tab_width) * _tab_width;
    } else while (point_column >= (_leftcol + co)) {
        // point is off the right edge of the screen
        _leftcol += _tab_width;
    } // else if
} // EmacsBuffer::forcePointInWindow
Ejemplo n.º 3
0
void SonicPiScintilla::backTenLines() {
  forwardLines(-10);
}
Ejemplo n.º 4
0
void SonicPiScintilla::forwardTenLines() {
  forwardLines(10);
}