JAL-2759 updateForDeletedRegion no longer needed
[jalview.git] / src / jalview / datamodel / HiddenColumns.java
index d2e46c6..c40c105 100644 (file)
@@ -75,7 +75,8 @@ public class HiddenColumns
   private HiddenColumnsCursor cursor = new HiddenColumnsCursor();
 
   /*
-   * cache of the number of hidden columns
+   * cache of the number of hidden columns: must be kept up to date by methods 
+   * which add or remove hidden columns
    */
   private int numColumns = 0;
 
@@ -287,7 +288,6 @@ public class HiddenColumns
     region[1] = Math.max(region[1], end);
 
     numColumns += oldstart - region[0];
-    numColumns += region[1] - oldend;
 
     /*
      * also update or remove any subsequent ranges 
@@ -305,11 +305,10 @@ public class HiddenColumns
         break;
       }
       numColumns -= nextRegion[1] - nextRegion[0] + 1;
-      oldend = nextRegion[1];
       region[1] = Math.max(nextRegion[1], end);
-      numColumns += region[1] - oldend + 1;
       endi++;
     }
+    numColumns += region[1] - oldend;
     hiddenColumns.subList(i + 1, endi + 1).clear();
   }
 
@@ -395,8 +394,6 @@ public class HiddenColumns
             int colsToRemove = region[1] - region[0] + 1;
             hiddenColumns.remove(regionIndex);
             numColumns -= colsToRemove;
-
-            cursor.updateForDeletedRegion(hiddenColumns);
           }
         }
       }