Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1244)

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/functions/FastDartPartitionScanner.java

Issue 8918017: Bug fix for computing partitions in subranges of the document (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/functions/FastDartPartitionScanner.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/functions/FastDartPartitionScanner.java (revision 2350)
+++ editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/functions/FastDartPartitionScanner.java (working copy)
@@ -124,6 +124,12 @@
private int tokenLength;
/**
+ * At the beginning of a scan, the number of characters between the beginning of the partition and
+ * the beginning of the range being scanned. At other times, zero (0).
+ */
+ private int prefixLength;
+
+ /**
* The state of the scanner.
*/
private int scannerState;
@@ -155,7 +161,8 @@
@Override
public IToken nextToken() {
tokenOffset += tokenLength;
- tokenLength = 0;
+ tokenLength = prefixLength;
+ prefixLength = 0;
int currentChar = scanner.peek(0);
while (currentChar != ICharacterScanner.EOF) {
switch (scannerState) {
@@ -390,6 +397,7 @@
scanner.setRange(document, offset, length);
tokenOffset = partitionOffset;
tokenLength = 0;
+ prefixLength = offset - partitionOffset;
if (offset == partitionOffset) {
// restart at beginning of partition
@@ -404,6 +412,7 @@
scanner.setRange(document, offset, length);
tokenOffset = offset;
tokenLength = 0;
+ prefixLength = 0;
scannerState = CODE;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698