From 776ca46131fac1974aaa79e0b947fe7dd0a7dbdc Mon Sep 17 00:00:00 2001 From: bananeweizen Date: Wed, 4 Jan 2006 23:09:54 +0000 Subject: [PATCH] reverted previous fix, it was bogus; applied similar changes at better location --- .../phpdt/internal/formatter/CodeFormatter.java | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java index 434287e..281ee1a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java @@ -1108,6 +1108,13 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { * @deprecated There is no need to retrieve the mapped positions anymore. */ public int[] getMappedPositions() { + if (null!=mappedPositions) { + for (int i=0;i=formattedSource.length()) { + mappedPositions[i]=formattedSource.length()-1; + } + } + } return mappedPositions; } @@ -2479,7 +2486,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { if (posToMap < 0 || posToMap >= sourceLength) { // protection against out of bounds position if (posToMap == sourceLength) { - mappedPositions[indexToMap] = formattedSource.length()-1; + mappedPositions[indexToMap] = formattedSource.length(); } indexToMap = positionsToMap.length; // no more mapping return; @@ -2492,9 +2499,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } else { mappedPositions[indexToMap] = posToMap + globalDelta + lineDelta; } - if (mappedPositions[indexToMap]>=formattedSource.length()) { - mappedPositions[indexToMap]=formattedSource.length()-1; - } } indexToMap++; } @@ -2506,9 +2510,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { while (indexInMap < mappedPositions.length && startPosition <= mappedPositions[indexInMap] && mappedPositions[indexInMap] < endPosition && indexInMap < indexToMap) { mappedPositions[indexInMap] += splitDelta; - if (mappedPositions[indexInMap]>=formattedSource.length()) { - mappedPositions[indexInMap]=formattedSource.length()-1; - } indexInMap++; } } -- 1.7.1