Source:
private void drawLineRange(GC gc, int startLine, int endLine, int x, int w) { final int viewPortWidth= fTextWidget.getClientArea().width; int spaceCharWidth = gc.stringExtent(" ").x; boolean optimizeWhitespacePainting = false; if ( (spaceCharWidth == gc.stringExtent(String.valueOf(SPACE_SIGN)).x) && (spaceCharWidth == gc.stringExtent(String.valueOf(IDEOGRAPHIC_SPACE_SIGN)).x)) { optimizeWhitespacePainting = true; } for (int line= startLine; line <= endLine; line++) { int lineOffset= fTextWidget.getOffsetAtLine(line); int lineEndOffset; if (line < fTextWidget.getLineCount() - 1) { lineEndOffset= fTextWidget.getOffsetAtLine(line + 1); } else { lineEndOffset= fTextWidget.getCharCount(); } int lineLength= lineEndOffset - lineOffset; while (lineLength > 0) { char c= fTextWidget.getTextRange(lineOffset + lineLength - 1, 1).charAt(0); if (c != '\r' && c != '\n') { break; } --lineLength; } Point endOfLine= fTextWidget.getLocationAtOffset(lineOffset + lineLength); if (x - endOfLine.x > viewPortWidth) { continue; } int y= fTextWidget.getLinePixel(line); int startOffset; try { startOffset= fTextWidget.getOffsetAtLocation(new Point(x, y)) - 1; if (startOffset - 2 <= lineOffset) { startOffset= lineOffset; } } catch (IllegalArgumentException iae) { startOffset= lineOffset; } int endOffset; if (x + w >= endOfLine.x) { endOffset= lineEndOffset; } else { try { endOffset= fTextWidget.getOffsetAtLocation(new Point(x + w - 1, y)) + 1; if (endOffset + 2 >= lineEndOffset) { endOffset= lineEndOffset; } } catch (IllegalArgumentException iae) { endOffset= lineEndOffset; } } if (endOffset > startOffset) { drawCharRange(gc, startOffset, endOffset, lineOffset, lineEndOffset, optimizeWhitespacePainting); } } }

Target:
private void drawLineRange(GC gc, int startLine, int endLine, int x, int w) { final int viewPortWidth= fTextWidget.getClientArea().width; int spaceCharWidth= gc.stringExtent(" ").x; boolean spaceCharsAreSameWidth= spaceCharWidth == gc.stringExtent(SPACE_SIGN_STRING).x && spaceCharWidth == gc.stringExtent(IDEOGRAPHIC_SPACE_SIGN_STRING).x; for (int line= startLine; line <= endLine; line++) { int lineOffset= fTextWidget.getOffsetAtLine(line); int lineEndOffset; if (line < fTextWidget.getLineCount() - 1) { lineEndOffset= fTextWidget.getOffsetAtLine(line + 1); } else { lineEndOffset= fTextWidget.getCharCount(); } int lineLength= lineEndOffset - lineOffset; while (lineLength > 0) { char c= fTextWidget.getTextRange(lineOffset + lineLength - 1, 1).charAt(0); if (c != '\r' && c != '\n') { break; } --lineLength; } Point endOfLine= fTextWidget.getLocationAtOffset(lineOffset + lineLength); if (x - endOfLine.x > viewPortWidth) { continue; } int y= fTextWidget.getLinePixel(line); int startOffset; try { startOffset= fTextWidget.getOffsetAtLocation(new Point(x, y)) - 1; if (startOffset - 2 <= lineOffset) { startOffset= lineOffset; } } catch (IllegalArgumentException iae) { startOffset= lineOffset; } int endOffset; if (x + w >= endOfLine.x) { endOffset= lineEndOffset; } else { try { endOffset= fTextWidget.getOffsetAtLocation(new Point(x + w - 1, y)) + 1; if (endOffset + 2 >= lineEndOffset) { endOffset= lineEndOffset; } } catch (IllegalArgumentException iae) { endOffset= lineEndOffset; } } if (endOffset > startOffset) { drawCharRange(gc, startOffset, endOffset, lineOffset, lineEndOffset, spaceCharsAreSameWidth); } } }