question: private int calculatePreferredWrapPosition ( @ NotNull Editor editor , @ NotNull CharSequence text , int tabSize , int spaceSize , int startLineOffset , int endLineOffset , int targetRangeEndOffset ) { boolean hasTabs = false ; boolean canOptimize = true ; boolean hasNonSpaceSymbols = false ; loop : for ( int i = startLineOffset ; i < Math . min ( endLineOffset , targetRangeEndOffset ) ; i ++ ) { char c = text . charAt ( i ) ; switch ( c ) { case '\t' : { hasTabs = true ; if ( hasNonSpaceSymbols ) { canOptimize = false ; break loop ; } } case ' ' : break ; default : hasNonSpaceSymbols = true ; } } if ( ! hasTabs ) { return wrapPositionForTextWithoutTabs ( startLineOffset , endLineOffset , targetRangeEndOffset ) ; } else if ( canOptimize ) { return wrapPositionForTabbedTextWithOptimization ( text , tabSize , startLineOffset , endLineOffset , targetRangeEndOffset ) ; } else { return wrapPositionForTabbedTextWithoutOptimization ( editor , text , spaceSize , startLineOffset , endLineOffset , targetRangeEndOffset ) ; } }
target:  Checks if it's worth to try to wrap target line (it's long enough) and tries to calculate preferred wrap position.