Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2008-01-14 17:07:14 -0500
committerpelder2008-01-14 17:07:14 -0500
commit2357232f90b8060b360451637c7d3dab196d3618 (patch)
tree6004dffe6ce945dd325a74c29e38f12ca8e9cb93
parent6c6a0487eeccf04951c34fc17cfb77a2925d71cd (diff)
downloadorg.eclipse.jet-2357232f90b8060b360451637c7d3dab196d3618.tar.gz
org.eclipse.jet-2357232f90b8060b360451637c7d3dab196d3618.tar.xz
org.eclipse.jet-2357232f90b8060b360451637c7d3dab196d3618.zip
[215269] [Regression] JET tags that track text positions break if text is inserted before these positions.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/BodyContentWriter.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/BodyContentWriter.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/BodyContentWriter.java
index 97999d0..301d01a 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/BodyContentWriter.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/BodyContentWriter.java
@@ -28,6 +28,7 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DefaultLineTracker;
import org.eclipse.jface.text.DefaultPositionUpdater;
+import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.DocumentRewriteSession;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
@@ -102,22 +103,22 @@ public class BodyContentWriter implements BufferedJET2Writer
public int getLineNumberOfOffset(int offset) throws BadLocationException
{
- return getLineNumberOfOffset(offset);
+ return getDelegate().getLineNumberOfOffset(offset);
}
public int getLineOffset(int line) throws BadLocationException
{
- return getLineOffset(line);
+ return getDelegate().getLineOffset(line);
}
public int getNumberOfLines()
{
- return getNumberOfLines();
+ return getDelegate().getNumberOfLines();
}
public int getNumberOfLines(int offset, int length) throws BadLocationException
{
- return getNumberOfLines(offset, length);
+ return getDelegate().getNumberOfLines(offset, length);
}
public void replace(int offset, int length, String text) throws BadLocationException
@@ -287,6 +288,10 @@ public class BodyContentWriter implements BufferedJET2Writer
getStore().replace(pos, length, text);
getTracker().replace(pos, length, text);
+
+ // But, update positions, if we have any...
+ DocumentEvent e= new DocumentEvent(this, pos, length, text);
+ updatePositions(e);
}
}

Back to the top