From 2abddda6c65d4825e97b51d19af438c46fcf54c7 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Sat, 17 Feb 2024 10:56:01 -0500 Subject: [PATCH] Fix formatting Signed-off-by: Geoff Hutchison --- avogadro/qtplugins/select/select.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/avogadro/qtplugins/select/select.cpp b/avogadro/qtplugins/select/select.cpp index 5eac997084..a02e17c61d 100644 --- a/avogadro/qtplugins/select/select.cpp +++ b/avogadro/qtplugins/select/select.cpp @@ -452,23 +452,23 @@ void Select::selectAtomIndex() auto range = item.split('-'); if (range.size() == 2) { bool ok1, ok2; - int k=m_molecule->atomCount(); + int k = m_molecule->atomCount(); int start = range.first().toInt(&ok1); int last = range.back().toInt(&ok2); if (ok1 && ok2) { - if(startundoMolecule()->setAtomSelected(i, evalSelect(true, i), - undoText); + 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(iundoMolecule()->setAtomSelected(i, evalSelect(true, i), - undoText); + if (i < k) + m_molecule->undoMolecule()->setAtomSelected(i, evalSelect(true, i), + undoText); } } @@ -580,4 +580,4 @@ void Select::createLayerFromSelection() rwmol->emitChanged(changes); } -} // namespace Avogadro::QtPlugins \ No newline at end of file +} // namespace Avogadro::QtPlugins