From b4e338d9552909ddf9079e61d00f5a7b18269340 Mon Sep 17 00:00:00 2001 From: James Procter Date: Mon, 20 Mar 2023 15:28:52 +0000 Subject: [PATCH] JAL-4134 fix off-by-one in selection --- src/jalview/gui/TreeCanvas.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index cae2f31..7af8940 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -1079,15 +1079,15 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, ColumnSelection cs = av.getColumnSelection(); HiddenColumns hc = av.getAlignment().getHiddenColumns(); { - int offp = (rseq!=null) ? rseq.findIndex(rseq.getStart()-1+colm) : colm; + int offp = (rseq!=null) ? rseq.findIndex(rseq.getStart()+colm) : colm; - if (!av.hasHiddenColumns() || hc.isVisible(offp)) + if (!av.hasHiddenColumns() || hc.isVisible(offp-1)) { - if (cs.contains(offp)) + if (cs.contains(offp-1)) { - cs.removeElement(offp); + cs.removeElement(offp-1); } else { - cs.addElement(offp); + cs.addElement(offp-1); } } } -- 1.7.10.2