From c8f1e88eaf4114e502a07c95ca7fb0c4d783f562 Mon Sep 17 00:00:00 2001 From: secretkontributer Date: Mon, 4 Dec 2023 14:06:16 +0530 Subject: [PATCH] Fixed Select Bugs from forum Signed-off-by: Kiran Vasave --- avogadro/qtplugins/select/select.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/avogadro/qtplugins/select/select.cpp b/avogadro/qtplugins/select/select.cpp index be76ac0fb8..5eac997084 100644 --- a/avogadro/qtplugins/select/select.cpp +++ b/avogadro/qtplugins/select/select.cpp @@ -450,11 +450,13 @@ 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(startundoMolecule()->setAtomSelected(i, evalSelect(true, i), undoText); @@ -462,7 +464,9 @@ void Select::selectAtomIndex() } } else { int i = item.toInt(&ok); + int k = m_molecule->atomCount(); if (ok) + if(iundoMolecule()->setAtomSelected(i, evalSelect(true, i), undoText); } @@ -576,4 +580,4 @@ void Select::createLayerFromSelection() rwmol->emitChanged(changes); } -} // namespace Avogadro::QtPlugins +} // namespace Avogadro::QtPlugins \ No newline at end of file