private final void draw(final GC gc, final int offset, final int length) { if (gc != null) { Point left = mTextWidget.getLocationAtOffset(offset); Point right = mTextWidget.getLocationAtOffset(offset + length); Color color = mMismatch ? mMismatchColor : mColor; if (mBox) { gc.setForeground(color); int x = left.x; int y = left.y; int w = right.x - left.x - 1; int h = gc.getFontMetrics().getHeight(); gc.drawRectangle(x, y, w, h); } else { gc.setForeground(mDefaultColor); gc.setBackground(color); gc.drawString(mTextWidget.getTextRange(offset, 1), left.x, left.y, false); } } else { mTextWidget.redrawRange(offset, length, true); } }