Ejemplo n.º 1
0
  int getPreferredHeight() {
    int lineHeight = myView.getLineHeight();
    if (myEditor.isOneLineMode()) return lineHeight;

    // Preferred height of less than a single line height doesn't make sense:
    // at least a single line with a blinking caret on it is to be displayed
    int size = Math.max(myEditor.getVisibleLineCount(), 1) * lineHeight;

    EditorSettings settings = myEditor.getSettings();
    if (settings.isAdditionalPageAtBottom()) {
      int visibleAreaHeight = myEditor.getScrollingModel().getVisibleArea().height;
      // There is a possible case that user with 'show additional page at bottom' scrolls to that
      // virtual page; switched to another
      // editor (another tab); and then returns to the previously used editor (the one scrolled to
      // virtual page). We want to preserve
      // correct view size then because viewport position is set to the end of the original text
      // otherwise.
      if (visibleAreaHeight > 0 || myVirtualPageHeight <= 0) {
        myVirtualPageHeight = Math.max(visibleAreaHeight - 2 * lineHeight, lineHeight);
      }

      size += Math.max(myVirtualPageHeight, 0);
    } else {
      size += settings.getAdditionalLinesCount() * lineHeight;
    }

    Insets insets = myView.getInsets();
    return size + insets.top + insets.bottom;
  }
Ejemplo n.º 2
0
 @Override
 @NotNull
 public ScrollingModelEx getScrollingModel() {
   return myDelegate.getScrollingModel();
 }
Ejemplo n.º 3
0
 private boolean shouldRespectAdditionalColumns(int widthWithoutCaret) {
   return !myEditor.getSoftWrapModel().isSoftWrappingEnabled()
       || myEditor.getSoftWrapModel().isRespectAdditionalColumns()
       || widthWithoutCaret > myEditor.getScrollingModel().getVisibleArea().getWidth();
 }