From ca3387f2bb9cd5b39ff89949ce3698af505f05fc Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 8 Jun 2010 14:25:35 +0000 Subject: [PATCH] Patch for incorrect column selection when hidden regions are present * JAL-558 --- src/jalview/datamodel/ColumnSelection.java | 20 ++++++++--------- src/jalview/gui/ScalePanel.java | 32 ++++++++++++++++++---------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index 4371994..63a5700 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -508,8 +508,8 @@ public class ColumnSelection } /** - * Use this method to find out where a visible column is in the alignment when - * hidden columns exist + * Use this method to find out where a column will appear in the visible alignment when + * hidden columns exist. If the column is not visible, then the left-most visible column will always be returned. * * @param hiddenColumn * int @@ -521,21 +521,21 @@ public class ColumnSelection if (hiddenColumns != null) { int index = 0; - int gaps = 0; + int[] region; do { - int[] region = (int[]) hiddenColumns.elementAt(index); + region = (int[]) hiddenColumns.elementAt(index++); if (hiddenColumn > region[1]) { result -= region[1] + 1 - region[0]; } - index++; - } while (index < hiddenColumns.size()); - - result -= gaps; + } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size())); + if (hiddenColumn>region[0] && hiddenColumn