Buggy code:
public int getLineHeight ( ) { } public int getLineHeight ( int offset ) { } 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 int getLeftMargin ( ) { } public Point getLocationAtOffset ( int offset ) { } public int getOffsetAtLine ( int lineIndex ) { } public int getOffsetAtLocation ( Point point ) { } int getOffsetAtPoint ( int x , int y , int [ ] alignment ) { } int getOffsetAtPoint ( int x , int y , int lineIndex , int [ ] alignment ) { } int getOffsetAtPoint ( int x , int y , int [ ] trailing , boolean inTextOnly ) { } public int getOrientation ( ) { } int getPartialBottomIndex ( ) { } int getPartialTopIndex ( ) { } String getPlatformDelimitedText ( StyledText . TextWriter writer ) { } public int [ ] getRanges ( ) { } public int [ ] getRanges ( int start , int length ) { } public int getRightMargin ( ) { } public Point getSelection ( ) { } public Point getSelectionRange ( ) { } public int [ ] getSelectionRanges ( ) { } 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 getTopMargin ( ) { } 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 ) { } int insertBlockSelectionText ( String text , boolean fillWithSpaces ) { } void insertBlockSelectionText ( char key , int action ) { } void installDefaultContent ( ) { } void installListeners ( ) { } void internalRedrawRange ( int start , int length ) { } void handleCompositionOffset ( Event event ) { } void handleCompositionSelection ( Event event ) { } void handleCompositionChanged ( Event event ) { String text = event . text ; int start = event . start ; int end = event . end ; int length = text . length ( ) ; if ( length == ( ime . getCommitCount ( ) ) ) { content . replaceTextRange ( start , ( end - start ) , "" ) ; setCaretOffset ( ime . getCompositionOffset ( ) , DEFAULT ) ; caretWidth = 0 ; caretDirection = SWT . NULL ; } else { content . replaceTextRange ( start , ( end - start ) , text ) ; <START_BUG> setCaretOffset ( ime . getCompositionOffset ( ) , DEFAULT ) ; <END_BUG> if ( ime . getWideCaret ( ) ) { start = ime . getCompositionOffset ( ) ; int lineIndex = getCaretLine ( ) ; int lineOffset = content . getOffsetAtLine ( lineIndex ) ; TextLayout layout = renderer . getTextLayout ( lineIndex ) ; caretWidth = layout . getBounds ( ( start - lineOffset ) , ( ( ( start + length ) - 1 ) - lineOffset ) ) . width ; renderer . disposeTextLayout ( layout ) ; } } showCaret ( ) ; } 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 invokeBlockAction ( int action ) { } boolean isBidi ( ) { } boolean isBidiCaret ( ) { } boolean isFixedLineHeight ( ) { } boolean isLineDelimiter ( int offset ) { } boolean isMirrored ( ) { } boolean isSingleLine ( ) { }

Fix:
setCaretOffset ( ime . getCaretOffset ( ) , DEFAULT ) ;