Buggy code:
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 handleDispose ( Event event ) { } void handleHorizontalScroll ( Event event ) { } void handleKey ( Event event ) { } void handleKeyDown ( Event event ) { } void handleKeyUp ( Event event ) { } void handleMouseDown ( Event event ) { forceFocus ( ) ; if ( ( dragDetect ) && ( checkDragDetect ( event ) ) ) return ; if ( ( event . button ) == 2 ) { String text = ( ( String ) ( getClipboardContent ( SELECTION_CLIPBOARD ) ) ) ; if ( ( text != null ) && ( ( text . length ( ) ) > 0 ) ) { doMouseLocationChange ( event . x , event . y , false ) ; Event e = new Event ( ) ; e . start = selection . x ; e . end = selection . y ; e . text = getModelDelimitedText ( text ) ; sendKeyEvent ( e ) ; } } if ( ( ( event . button ) != 1 ) || ( ( StyledText . IS_CARBON ) && ( ( ( event . stateMask ) & ( SWT . MOD4 ) ) != 0 ) ) ) { return ; } clickCount = event . count ; if ( ( clickCount ) == 1 ) { boolean select = ( ( event . stateMask ) & ( SWT . MOD2 ) ) != 0 ; doMouseLocationChange ( event . x , event . y , select ) ; } else { if ( doubleClickEnabled ) { clearSelection ( false ) ; int offset = getOffsetAtPoint ( event . x , event . y ) ; int lineIndex = content . getLineAtOffset ( offset ) ; int lineOffset = content . getOffsetAtLine ( lineIndex ) ; int lineEnd = content . getCharCount ( ) ; if ( ( lineIndex + 1 ) < ( content . getLineCount ( ) ) ) { lineEnd = content . getOffsetAtLine ( ( lineIndex + 1 ) ) ; } int start ; int end ; if ( ( ( clickCount ) & 1 ) == 0 ) { start = Math . max ( 0 , getWordPrevious ( offset , MOVEMENT_WORD_START ) ) ; <START_BUG> end = Math . min ( getCharCount ( ) , getWordNext ( start , MOVEMENT_WORD_END ) ) ; <END_BUG> } else { start = lineOffset ; end = lineEnd ; } selection . x = selection . y = start ; selectionAnchor = - 1 ; caretOffset = end ; showCaret ( ) ; doMouseSelection ( ) ; doubleClickSelection = new Point ( selection . x , selection . y ) ; } } } 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:
end = Math . min ( content . getCharCount ( ) , getWordNext ( start , MOVEMENT_WORD_END ) ) ;