* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: MultiViewPartitioner.java,v 1.8 2005-05-05 19:08:50 axelcl Exp $
+ * $Id: MultiViewPartitioner.java,v 1.9 2005-05-13 20:17:31 axelcl Exp $
*/
package net.sourceforge.phpeclipse.ui.text.rules;
*/
public ITypedRegion[] computePartitioning(int offset, int length) {
List list = new ArrayList();
- // if (DEBUG) {
- // System.out.print("MultiViewPartitioner::computePartitioning - Offset: ");
- // System.out.print(offset);
- // System.out.print(", Length: ");
- // System.out.print(length);
- // System.out.println("");
- // }
+// if (DEBUG) {
+// if (length>=9400) {
+// length--;
+// }
+// System.out.print("MultiViewPartitioner::computePartitioning - Offset: ");
+// System.out.print(offset);
+// System.out.print(", Length: ");
+// System.out.print(length);
+// System.out.println("");
+// }
int end = offset + length;
int index = computeFlatNodeIndex(offset);
return;
}
- try {
+ try {
// convert to outer offsets
start = outerDocument.getLocalOffset(start);
end = outerDocument.getLocalOffset(end);
- if (end - start >= 0) {//jsurfer insert line
- ITypedRegion[] regions = outerDocument.computePartitioning(start, end - start);
-
+ int len = end - start;
+ if (len >= 0) {
+ ITypedRegion[] regions = null;
+ try {
+ regions = outerDocument.computePartitioning(start, len);
+ } catch (Exception e) {
+ // nasty workaround, which prevents cursor from moveing backwards in the editor
+ // but doesn't solve the partitioning problem
+ regions = new ITypedRegion[0];
+ System.out.println("MultiViewerPartitioner#addOuterPartitions failure\n"+"start:"+start +" length:" +len+"\n"+outerDocument.get(start,len));
+ }
for (int i = 0; i < regions.length; i++) {
ITypedRegion region = regions[i];