+ boolean found = false;
+ while ((!found || findAll) && sequenceIndex < end)
+ {
+ found = findNextMatch(searchString, searchPattern, searchDescription,
+ ignoreHidden);
+ }
+ }
+
+ /**
+ * Calculates and saves the sequence string to search. The string is restricted
+ * to the current selection region if there is one, and is saved with all gaps
+ * removed.
+ * <p>
+ * If there are hidden columns, and option {@ignoreHidden} is selected, then
+ * only visible positions of the sequence are included, and a mapping is also
+ * constructed from the returned string positions to the true sequence
+ * positions.
+ * <p>
+ * Note we have to do this each time {@code findNext} or {@code findAll} is
+ * called, in case the alignment, selection group or hidden columns have
+ * changed. In particular, if the sequence at offset {@code sequenceIndex} in
+ * the alignment is (no longer) in the selection group, search is advanced to
+ * the next sequence that is.
+ * <p>
+ * Sets sequence string to the empty string if there are no more sequences (in
+ * selection group if any) at or after {@code sequenceIndex}.
+ * <p>
+ * Returns true if a sequence could be found, false if end of alignment was
+ * reached
+ *
+ * @param ignoreHidden
+ * @return
+ */
+ private boolean getSequence(boolean ignoreHidden)
+ {
+ AlignmentI alignment = viewport.getAlignment();
+ if (sequenceIndex >= alignment.getHeight())
+ {
+ seqToSearch = "";
+ return false;
+ }
+ SequenceI seq = alignment.getSequenceAt(sequenceIndex);
+ SequenceGroup selection = viewport.getSelectionGroup();
+ if (selection != null && !selection.contains(seq))