From fcbe1ce542569613ebdcd0fd4fdbef9daf0184e9 Mon Sep 17 00:00:00 2001 From: axelcl Date: Fri, 13 May 2005 20:17:31 +0000 Subject: [PATCH 1/1] Wrong partition length raises exception nasty workaround, which prevents cursor from moveing backwards in the edito, but doesn't solve the partitioning problem --- .../ui/text/rules/MultiViewPartitioner.java | 35 +++++++++++++------- 1 files changed, 23 insertions(+), 12 deletions(-) diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java index 17d5156..b33b381 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java @@ -8,7 +8,7 @@ * 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; @@ -438,13 +438,16 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { */ 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); @@ -528,13 +531,21 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { 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]; -- 1.7.1