Buggy code:
public int getLineIndent ( int index ) { } public boolean getLineJustify ( int index ) { } public int getLineSpacing ( ) { } StyledTextEvent getLineStyleData ( int lineOffset , String line ) { } public int getLinePixel ( int lineIndex ) { } public int getLineIndex ( int y ) { } public Point getLocationAtOffset ( int offset ) { } public int getOffsetAtLine ( int lineIndex ) { } public int getOffsetAtLocation ( Point point ) { } int getOffsetAtPoint ( int x , int y ) { } int getOffsetAtPoint ( int x , int y , int lineIndex ) { } int getOffsetAtPoint ( int x , int y , int [ ] trailing ) { } public int getOrientation ( ) { } int getPartialBottomIndex ( ) { } int getPartialTopIndex ( ) { } String getPlatformDelimitedText ( StyledText . TextWriter writer ) { } public int [ ] getRanges ( ) { } public int [ ] getRanges ( int start , int length ) { } public Point getSelection ( ) { } public Point getSelectionRange ( ) { } public Color getSelectionBackground ( ) { } public int getSelectionCount ( ) { } public Color getSelectionForeground ( ) { } public String getSelectionText ( ) { } public int getStyle ( ) { } int [ ] getBidiSegments ( int lineOffset , String line ) { } int [ ] getBidiSegmentsCompatibility ( String line , int lineOffset ) { } public StyleRange getStyleRangeAtOffset ( int offset ) { } public StyleRange [ ] getStyleRanges ( ) { } public StyleRange [ ] getStyleRanges ( boolean includeRanges ) { } public StyleRange [ ] getStyleRanges ( int start , int length ) { } public StyleRange [ ] getStyleRanges ( int start , int length , boolean includeRanges ) { } public int getTabs ( ) { } public String getText ( ) { } public String getText ( int start , int end ) { } public Rectangle getTextBounds ( int start , int end ) { } public String getTextRange ( int start , int length ) { } public int getTextLimit ( ) { } public int getTopIndex ( ) { } public int getTopPixel ( ) { } int getVerticalIncrement ( ) { } int getVerticalScrollOffset ( ) { } int getVisualLineIndex ( TextLayout layout , int offsetInLine ) { } int getCaretDirection ( ) { } int getCaretLine ( ) { } int getWrapWidth ( ) { } int getWordNext ( int offset , int movement ) { } int getWordPrevious ( int offset , int movement ) { } public boolean getWordWrap ( ) { } Point getPointAtOffset ( int offset ) { } public void insert ( String string ) { } void installDefaultContent ( ) { } void installListeners ( ) { } void internalRedrawRange ( int start , int length ) { } void handleCompositionHittest ( Event event ) { } void handleCompositionChanged ( Event event ) { String text = event . text ; int length = text . length ( ) ; if ( ( compositionStart ) == ( - 1 ) ) { compositionStart = caretOffset ; compositionLength = 0 ; } int oldLength = compositionLength ; compositionLength = 0 ; renderer . imeRanges = null ; renderer . imeStyles = null ; if ( length == ( event . count ) ) { content . replaceTextRange ( compositionStart , oldLength , "" ) ; caretOffset = compositionStart ; compositionStart = - 1 ; caretWidth = 0 ; caretDirection = SWT . NULL ; } else { content . replaceTextRange ( compositionStart , oldLength , text ) ; compositionLength = length ; caretOffset = ( compositionStart ) + ( event . index ) ; int lineIndex = getCaretLine ( ) ; renderer . imeRanges = event . ranges ; renderer . imeStyles = event . styles ; <START_BUG> renderer . reset ( lineIndex , 1 ) ; <END_BUG> if ( event . wideCaret ) { int lineOffset = content . getOffsetAtLine ( lineIndex ) ; TextLayout layout = renderer . getTextLayout ( lineIndex ) ; caretWidth = layout . getBounds ( ( ( compositionStart ) - lineOffset ) , ( ( ( ( compositionStart ) + ( compositionLength ) ) - 1 ) - lineOffset ) ) . width ; renderer . disposeTextLayout ( layout ) ; } } showCaret ( ) ; } void handleImeComposition ( Event event ) { } void handleDispose ( Event event ) { } void handleHorizontalScroll ( Event event ) { } void handleKey ( Event event ) { } void handleKeyDown ( Event event ) { } void handleKeyUp ( Event event ) { } void handleMouseDown ( Event event ) { } void handleMouseMove ( Event event ) { } void handleMouseUp ( Event event ) { } void handlePaint ( Event event ) { } void handleResize ( Event event ) { } void handleTextChanged ( TextChangedEvent event ) { } void handleTextChanging ( TextChangingEvent event ) { } void handleTextSet ( TextChangedEvent event ) { } void handleTraverse ( Event event ) { } void handleVerticalScroll ( Event event ) { } void initializeAccessible ( ) { } Label getAssociatedLabel ( ) { } String stripMnemonic ( String string ) { } char _findMnemonic ( String string ) { } public void invokeAction ( int action ) { } boolean isBidi ( ) { } boolean isBidiCaret ( ) { } boolean isFixedLineHeight ( ) { } boolean isLineDelimiter ( int offset ) { } boolean isMirrored ( ) { } boolean isSingleLine ( ) { } void modifyContent ( Event event , boolean updateCaret ) { } void paintObject ( GC gc , int x , int y , int ascent , int descent , StyleRange style , Bullet bullet , int bulletIndex ) { } public void paste ( ) { }

Fix:
resetCache ( lineIndex , 1 ) ;