int () { if (ourIsUnitTestMode && getUserData(DO_DOCUMENT_UPDATE_TEST) == null) { return 1; } if (isOneLineMode()) return getLineHeight(); // 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(getVisibleLineCount(), 1) * getLineHeight(); if (mySettings.isAdditionalPageAtBottom()) { int lineHeight = getLineHeight(); int visibleAreaHeight = 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); } return size + Math.max(myVirtualPageHeight, 0); } return size + mySettings.getAdditionalLinesCount() * getLineHeight(); }