void invalidateRange(int startOffset, int endOffset) {
   myWidthInPixels = -1;
   int startVisualLine = myView.offsetToVisualLine(startOffset, false);
   int endVisualLine = myView.offsetToVisualLine(endOffset, true);
   int lineDiff = myEditor.getVisibleLineCount() - myLineWidths.size();
   if (lineDiff > 0) {
     int[] newEntries = new int[lineDiff];
     myLineWidths.insert(startVisualLine, newEntries);
   } else if (lineDiff < 0) {
     myLineWidths.remove(startVisualLine, -lineDiff);
   }
   for (int i = startVisualLine; i <= endVisualLine && i < myLineWidths.size(); i++) {
     myLineWidths.set(i, UNKNOWN_WIDTH);
   }
 }
Example #2
0
 private boolean checkDirty() {
   if (myEditor.getSoftWrapModel().isDirty()) {
     myDirty = true;
     return true;
   }
   if (myDirty) {
     int visibleLineCount = myEditor.getVisibleLineCount();
     int lineDiff = visibleLineCount - myLineWidths.size();
     if (lineDiff > 0) myLineWidths.add(new int[lineDiff]);
     else if (lineDiff < 0) myLineWidths.remove(visibleLineCount, -lineDiff);
     for (int i = 0; i < visibleLineCount; i++) {
       myLineWidths.set(i, UNKNOWN_WIDTH);
     }
     myDirty = false;
   }
   return false;
 }
 public static int getFreeRecord() {
   if (myFreeRecords.isEmpty()) return 0;
   return myFreeRecords.remove(myFreeRecords.size() - 1);
 }