Buggy code:
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 ) { if ( ( key == ( SWT . CR ) ) || ( key == ( SWT . LF ) ) ) return ; Rectangle rect = getBlockSelectonPosition ( ) ; int firstLine = rect . y ; int lastLine = rect . height ; int left = rect . x ; int right = rect . width ; int [ ] trailing = new int [ 1 ] ; int offset = 0 ; int delta = 0 ; String text = ( key != 0 ) ? new String ( new char [ ] { key } ) : "" ; int length = text . length ( ) ; for ( int lineIndex = firstLine ; lineIndex <= lastLine ; lineIndex ++ ) { String line = content . getLine ( lineIndex ) ; int lineOffset = content . getOffsetAtLine ( lineIndex ) ; int lineEndOffset = lineOffset + ( line . length ( ) ) ; int linePixel = getLinePixel ( lineIndex ) ; int start = getOffsetAtPoint ( left , linePixel , trailing , true ) ; boolean outOfLine = start == ( - 1 ) ; if ( outOfLine ) { start = ( left < ( leftMargin ) ) ? lineOffset : lineEndOffset ; } else { start += trailing [ 0 ] ; } int end = getOffsetAtPoint ( right , linePixel , trailing , true ) ; if ( end == ( - 1 ) ) { end = ( right < ( leftMargin ) ) ? lineOffset : lineEndOffset ; } else { end += trailing [ 0 ] ; } if ( ( start == end ) && ( ! outOfLine ) ) { switch ( action ) { case ST . DELETE_PREVIOUS : if ( start > lineOffset ) start = getClusterPrevious ( start , lineIndex ) ; break ; case ST . DELETE_NEXT : if ( end < lineEndOffset ) end = getClusterNext ( end , lineIndex ) ; break ; } } if ( outOfLine ) { <START_BUG> if ( ( line . length ( ) ) > delta ) { <END_BUG> delta = line . length ( ) ; offset = lineEndOffset + length ; } } else { offset = start + length ; delta = content . getCharCount ( ) ; } Event event = new Event ( ) ; event . text = text ; event . start = start ; event . end = end ; sendKeyEvent ( event ) ; } int x = getPointAtOffset ( offset ) . x ; int verticalScrollOffset = getVerticalScrollOffset ( ) ; setBlockSelectionLocation ( x , ( ( blockYAnchor ) - verticalScrollOffset ) , x , ( ( blockYLocation ) - verticalScrollOffset ) , false ) ; } void installDefaultContent ( ) { } void installListeners ( ) { } void internalRedrawRange ( int start , int length ) { } void handleCompositionOffset ( Event event ) { } void handleCompositionSelection ( Event event ) { } void handleCompositionChanged ( 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 ) { }

Fix:
if ( ( line . length ( ) ) >= delta ) {