Author: scabanovich
Date: 2008-03-21 05:24:26 -0400 (Fri, 21 Mar 2008)
New Revision: 7055
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
Log:
JBIDE-1940
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-03-21
09:19:33 UTC (rev 7054)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-03-21
09:24:26 UTC (rev 7055)
@@ -831,31 +831,25 @@
Point pp = t.toControl(x, y);
x = pp.x;
y = pp.y;
- try {
- int lineIndex = (t.getTopPixel() + y) / t.getLineHeight();
- if (lineIndex >= t.getLineCount()) {
- return t.getCharCount();
- } else {
- int c = 0;
- try {
- c = t.getOffsetAtLocation(new Point(x, y));
- if (c < 0)
- c = 0;
- } catch (IllegalArgumentException ex) {
- //do not log, catching that exception is
- //the way to know that we are out of line.
- c = t.getOffsetAtLine(lineIndex + 1)
- - (t.getLineDelimiter() == null ? 0
- : t.getLineDelimiter().length());
- }
- return c;
+ int lineIndex = (t.getTopPixel() + y) / t.getLineHeight();
+ if (lineIndex >= t.getLineCount()) {
+ return t.getCharCount();
+ } else {
+ int c = 0;
+ try {
+ c = t.getOffsetAtLocation(new Point(x, y));
+ if (c < 0) c = 0;
+ } catch (IllegalArgumentException ex) {
+ //do not log, catching that exception is
+ //the way to know that we are out of line.
+ if (lineIndex + 1 >= t.getLineCount()) {
+ return t.getCharCount();
+ }
+ c = t.getOffsetAtLine(lineIndex + 1)
+ - (t.getLineDelimiter() == null
+ ? 0 : t.getLineDelimiter().length());
}
- } catch (IllegalArgumentException ex) {
- //do not log, now we know are out of input area.
- return 0;
- } catch (Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
- return 0;
+ return c;
}
}
Show replies by date