Dimension () { if (myUseNewRendering) return myView.getPreferredSize(); if (ourIsUnitTestMode && getUserData(DO_DOCUMENT_UPDATE_TEST) == null) { return new Dimension(1, 1); } final Dimension draft = getSizeWithoutCaret(); final int additionalSpace = shouldRespectAdditionalColumns() ? mySettings.getAdditionalColumnsCount() * EditorUtil.getSpaceWidth(Font.PLAIN, this) : 0; if (!myDocument.isInBulkUpdate()) { for (Caret caret : myCaretModel.getAllCarets()) { if (caret.isUpToDate()) { int caretX = visualPositionToXY(caret.getVisualPosition()).x; draft.width = Math.max(caretX, draft.width); } } } draft.width += additionalSpace; return draft; }