From: amwaterhouse Date: Wed, 25 Oct 2006 13:59:54 +0000 (+0000) Subject: Adjusts hiddenColumns correctly X-Git-Tag: Release_2_2~236 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d4f6172fff9d39d2cf3bd1a8d0260521615a5993;p=jalview.git Adjusts hiddenColumns correctly --- diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index 60d7aea..6b44832 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -175,8 +175,9 @@ public class ColumnSelection * @param start beginning of edit * @param left shift in edit (+ve for removal, or -ve for inserts) */ - public void compensateForEdit(int start, int change) + public Vector compensateForEdit(int start, int change) { + Vector deletedHiddenColumns = null; for (int i = 0; i < size(); i++) { int temp = columnAt(i); @@ -189,20 +190,37 @@ public class ColumnSelection if(hiddenColumns!=null) { - for(int i=0; i start) + if ( region[0]>start && start+change>region[1] ) + { + deletedHiddenColumns.addElement( + hiddenColumns.elementAt(i)); + + hiddenColumns.removeElementAt(i); + i--; + hSize--; + continue; + } + + if(region[0]>start) { region[0] -= change; region[1] -= change; } + if(region[0]<0) region[0] = 0; - if(region[1] <0) - region[1] = 0; + } + + this.revealHiddenColumns(0); } + + return deletedHiddenColumns; } /** * propagate shift in alignment columns to column selection