Index: E:/workspace-3.3.1.1-jboss/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/ui/FreeCaretStyledText.java =================================================================== --- E:/workspace-3.3.1.1-jboss/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/ui/FreeCaretStyledText.java (revision 5570) +++ E:/workspace-3.3.1.1-jboss/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/ui/FreeCaretStyledText.java (working copy) @@ -70,8 +70,24 @@ try { super.redrawRange(start, length, clearBackground); } catch (Exception x) { - //ignore + if (start > getCharCount()) + start = getCharCount(); + if (start + length > getCharCount()) + length = getCharCount() - start; + super.redrawRange(start, length, clearBackground); } } + public int getLineAtOffset(int offset) { + try { + return super.getLineAtOffset(offset); + } catch (Exception e) { + if (offset > getCharCount()) + offset = getCharCount(); + if (offset < 0) + offset = 0; + return super.getLineAtOffset(offset); + } + } + }