@Override
  public void scrollTo(int offset) {
    if (getEditor() == null) return;
    final class ScrollRunnable extends FlushRunnable {
      private ScrollRunnable() {
        super(true); // each request must be executed
      }

      @Override
      public void doRun() {
        flushDeferredText();
        Editor editor = getEditor();
        if (editor == null) return;
        int moveOffset = getEffectiveOffset(editor);
        editor.getCaretModel().moveToOffset(moveOffset);
        editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
      }

      private int getEffectiveOffset(@NotNull Editor editor) {
        int moveOffset = Math.min(offset, editor.getDocument().getTextLength());
        if (ConsoleBuffer.useCycleBuffer() && moveOffset >= editor.getDocument().getTextLength()) {
          moveOffset = 0;
        }
        return moveOffset;
      }
    }
    addFlushRequest(0, new ScrollRunnable());
  }
@Override
  public void scrollTo(int offset)