Source:
<code>private IRegion computeClippingRegion(PaintEvent event, boolean isClearing) { if (event == null) { if (!isClearing && fCurrentDrawRange != null) return new Region(fCurrentDrawRange.offset, fCurrentDrawRange.length); int vOffset= getInclusiveTopIndexStartOffset(); if (vOffset == -1) return null; int vLength= getExclusiveBottomIndexEndOffset() - vOffset; return new Region(vOffset, vLength); } int widgetOffset; try { int widgetClippingStartOffset= fTextWidget.getOffsetAtPoint(new Point(0, event.y)); int firstWidgetLine= <START> fTextWidget.getLineAtOffset(widgetClippingStartOffset); <END> widgetOffset= fTextWidget.getOffsetAtLine(firstWidgetLine); } catch (IllegalArgumentException ex1) { try { int firstVisibleLine= JFaceTextUtil.getPartialTopIndex(fTextWidget); widgetOffset= fTextWidget.getOffsetAtLine(firstVisibleLine); } catch (IllegalArgumentException ex2) { widgetOffset= 0; } } int widgetEndOffset; try { int widgetClippingEndOffset= fTextWidget.getOffsetAtPoint(new Point(0, event.y + event.height)); int lastWidgetLine= fTextWidget.getLineAtOffset(widgetClippingEndOffset); widgetEndOffset= fTextWidget.getOffsetAtLine(lastWidgetLine + 1); } catch (IllegalArgumentException ex1) { try { int lastVisibleLine= JFaceTextUtil.getPartialBottomIndex(fTextWidget); if (lastVisibleLine == fTextWidget.getLineCount() - 1) widgetEndOffset= fTextWidget.getCharCount(); else widgetEndOffset= fTextWidget.getOffsetAtLine(lastVisibleLine + 1) - 1; } catch (IllegalArgumentException ex2) { widgetEndOffset= fTextWidget.getCharCount(); } } IRegion clippingRegion= getModelRange(widgetOffset, widgetEndOffset - widgetOffset); return clippingRegion; }</code><technical_language>if widgetClippingStartOffset == -1 do call getLineAtOffset() this? This throw exception avoid</technical_language>

Target:
private IRegion computeClippingRegion(PaintEvent event, boolean isClearing) { if (event == null) { if (!isClearing && fCurrentDrawRange != null) return new Region(fCurrentDrawRange.offset, fCurrentDrawRange.length); int vOffset= getInclusiveTopIndexStartOffset(); if (vOffset == -1) return null; int vLength= getExclusiveBottomIndexEndOffset() - vOffset; return new Region(vOffset, vLength); } int widgetOffset= -1; int widgetClippingStartOffset= fTextWidget.getOffsetAtPoint(new Point(0, event.y)); if (widgetClippingStartOffset != -1) { try { int firstWidgetLine= fTextWidget.getLineAtOffset(widgetClippingStartOffset); widgetOffset= fTextWidget.getOffsetAtLine(firstWidgetLine); } catch (IllegalArgumentException ex) { } } if (widgetOffset == -1) { try { int firstVisibleLine= JFaceTextUtil.getPartialTopIndex(fTextWidget); widgetOffset= fTextWidget.getOffsetAtLine(firstVisibleLine); } catch (IllegalArgumentException ex) { widgetOffset= 0; } } int widgetEndOffset= -1; int widgetClippingEndOffset= fTextWidget.getOffsetAtPoint(new Point(0, event.y + event.height)); if (widgetClippingEndOffset != -1) { try { int lastWidgetLine= fTextWidget.getLineAtOffset(widgetClippingEndOffset); widgetEndOffset= fTextWidget.getOffsetAtLine(lastWidgetLine + 1); } catch (IllegalArgumentException ex1) { } } if (widgetEndOffset == -1) { try { int lastVisibleLine= JFaceTextUtil.getPartialBottomIndex(fTextWidget); if (lastVisibleLine == fTextWidget.getLineCount() - 1) { widgetEndOffset= fTextWidget.getCharCount(); } else { widgetEndOffset= fTextWidget.getOffsetAtLine(lastVisibleLine + 1) - 1; } } catch (IllegalArgumentException ex) { widgetEndOffset= fTextWidget.getCharCount(); } } IRegion clippingRegion= getModelRange(widgetOffset, widgetEndOffset - widgetOffset); return clippingRegion; }