Пример #1
0
  public Rectangle getPositionBounds(InputEditorPosition position) {
    Renderer renderer = widget_.getEditor().getRenderer();

    Position pos = ((AceInputEditorPosition) position).getValue();

    ScreenCoordinates start = renderer.textToScreenCoordinates(pos.getRow(), pos.getColumn());

    return new Rectangle(
        start.getPageX(),
        start.getPageY(),
        (int) Math.round(renderer.getCharacterWidth()),
        (int) (renderer.getLineHeight() * 0.8));
  }
Пример #2
0
  @Override
  public void highlightDebugLocation(
      SourcePosition startPosition, SourcePosition endPosition, boolean executing) {
    int firstRow = widget_.getEditor().getFirstVisibleRow();
    int lastRow = widget_.getEditor().getLastVisibleRow();

    // if the expression is large, let's just try to land in the middle
    int debugRow =
        (int)
            Math.floor(
                startPosition.getRow() + (endPosition.getRow() - startPosition.getRow()) / 2);

    // if the row at which the debugging occurs is inside a fold, unfold it
    getSession().unfold(debugRow, true);

    // if the line to be debugged is past or near the edges of the screen,
    // scroll it into view. allow some lines of context.
    if (debugRow <= (firstRow + DEBUG_CONTEXT_LINES)
        || debugRow >= (lastRow - DEBUG_CONTEXT_LINES)) {
      widget_.getEditor().scrollToLine(debugRow, true);
    }

    applyDebugLineHighlight(startPosition.asPosition(), endPosition.asPosition(), executing);
  }
Пример #3
0
 @Override
 public void moveCursorNearTop(int rowOffset) {
   int screenRow = getSession().documentToScreenRow(getCursorPosition());
   widget_.getEditor().scrollToRow(Math.max(0, screenRow - rowOffset));
 }