- while((idx = finder.toNextBoundary()) >= 0 && idx < length) {
- idx++; // the boundary is *before* the actual character
+ while((idx = finder.toNextBoundary()) >= 0 && idx <= length) {
+ if(idx < length)
+ idx++; // the boundary is *before* the actual character
+
+ if(idx == oldidx)
+ continue;