From d4f6172fff9d39d2cf3bd1a8d0260521615a5993 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 25 Oct 2006 13:59:54 +0000 Subject: [PATCH] Adjusts hiddenColumns correctly --- src/jalview/datamodel/ColumnSelection.java | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) 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 -- 1.7.10.2