This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 159125
Collapse All | Expand All

(-)a/editor.lib2/src/org/netbeans/modules/editor/lib2/highlighting/CompoundHighlightsContainer.java (-3 / +31 lines)
Lines 287-293 Link Here
287
        }
287
        }
288
    }
288
    }
289
289
290
    private void updateCache(int startOffset, int endOffset, OffsetsBag bag) {
290
    private void updateCache(final int startOffset, final int endOffset, OffsetsBag bag) {
291
        if (LOG.isLoggable(Level.FINE)) {
291
        if (LOG.isLoggable(Level.FINE)) {
292
            LOG.fine("Updating cache: <" + startOffset + ", " + endOffset + ">"); //NOI18N
292
            LOG.fine("Updating cache: <" + startOffset + ", " + endOffset + ">"); //NOI18N
293
        }
293
        }
Lines 298-305 Link Here
298
            }
298
            }
299
299
300
            try {
300
            try {
301
                HighlightsSequence seq = layers[i].getHighlights(startOffset, endOffset);
301
                final HighlightsSequence seq = layers[i].getHighlights(startOffset, endOffset);
302
                bag.addAllHighlights(seq);
302
                final int layerIndex = i; //saving this so we can debug corrupt layers (aka the ones that need clipping)
303
                bag.addAllHighlights(new HighlightsSequence() {
304
305
                    public boolean moveNext() {
306
                        return seq.moveNext();
307
                    }
308
309
                    public int getStartOffset() {
310
                        int start = seq.getStartOffset();
311
                        if(start < startOffset){
312
                            LOG.warning("Corrupt layer found ("+layerIndex+"). StartOffset "+start+" should be >="+startOffset+". Clipping...");
313
                            return startOffset;
314
                        }
315
                        return start;
316
                    }
317
318
                    public int getEndOffset() {
319
                        int end = seq.getEndOffset();
320
                        if(end > endOffset){
321
                            LOG.warning("Corrupt layer found ("+layerIndex+"). EndOffset "+end+" should be <="+endOffset+". Clipping...");
322
                            return endOffset;
323
                        }
324
                        return end;
325
                    }
326
327
                    public AttributeSet getAttributes() {
328
                        return seq.getAttributes();
329
                    }
330
                });
303
                if (LOG.isLoggable(Level.FINE)) {
331
                if (LOG.isLoggable(Level.FINE)) {
304
                    LOG.fine(dumpLayerHighlights(layers[i], startOffset, endOffset));
332
                    LOG.fine(dumpLayerHighlights(layers[i], startOffset, endOffset));
305
                }
333
                }

Return to bug 159125