From: James Procter Date: Mon, 20 Mar 2023 15:28:52 +0000 (+0000) Subject: JAL-4134 fix off-by-one in selection X-Git-Tag: Release_2_11_3_0~15^2^2~7 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b4e338d9552909ddf9079e61d00f5a7b18269340;p=jalview.git JAL-4134 fix off-by-one in selection --- 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); } } }