Skip to content

Commit

Permalink
Fixed Select Bugs from forum
Browse files Browse the repository at this point in the history
Signed-off-by: Kiran Vasave <[email protected]>
  • Loading branch information
secretkontributer authored and ghutchis committed Feb 17, 2024
1 parent 36de39b commit c8f1e88
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions avogadro/qtplugins/select/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,19 +450,23 @@ void Select::selectAtomIndex()
// check if it's a range
if (item.contains('-')) {
auto range = item.split('-');
if (range.size() >= 2) {
if (range.size() == 2) {
bool ok1, ok2;
int k=m_molecule->atomCount();
int start = range.first().toInt(&ok1);
int last = range.back().toInt(&ok2);
if (ok1 && ok2) {
if(start<k)
for (int i = start; i <= last; ++i)
m_molecule->undoMolecule()->setAtomSelected(i, evalSelect(true, i),
undoText);
}
}
} else {
int i = item.toInt(&ok);
int k = m_molecule->atomCount();
if (ok)
if(i<k)
m_molecule->undoMolecule()->setAtomSelected(i, evalSelect(true, i),
undoText);
}
Expand Down Expand Up @@ -576,4 +580,4 @@ void Select::createLayerFromSelection()
rwmol->emitChanged(changes);
}

} // namespace Avogadro::QtPlugins
} // namespace Avogadro::QtPlugins

0 comments on commit c8f1e88

Please sign in to comment.