Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2008-01-14 17:00:26 -0500
committerpelder2008-01-14 17:00:26 -0500
commit82931df8c37de9e8323727e27ff5f28008b861b7 (patch)
tree234c54c8077b31c838a9c286ecf3058155619618
parentff9e917b66b7351468fec290f28b6489f6f3fa14 (diff)
downloadorg.eclipse.jet-82931df8c37de9e8323727e27ff5f28008b861b7.tar.gz
org.eclipse.jet-82931df8c37de9e8323727e27ff5f28008b861b7.tar.xz
org.eclipse.jet-82931df8c37de9e8323727e27ff5f28008b861b7.zip
[215263] [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