Skip to content

Commit

Permalink
Merge pull request #510 from ghutchis/clear-selected-atoms
Browse files Browse the repository at this point in the history
Add support for only clearing selected atoms
  • Loading branch information
ghutchis authored Jan 23, 2021
2 parents 926573b + b90286b commit fe57183
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion avogadro/qtplugins/copypaste/copypaste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ void CopyPaste::cut()

void CopyPaste::clear()
{
m_molecule->undoMolecule()->clearAtoms();
if (m_molecule->isSelectionEmpty())
m_molecule->undoMolecule()->clearAtoms();
else {
for (Index i = 0; i < m_molecule->atomCount(); ++i)
if (m_molecule->atomSelected(i))
m_molecule->undoMolecule()->removeAtom(i);
}
m_molecule->emitChanged(QtGui::Molecule::Atoms | QtGui::Molecule::Bonds |
QtGui::Molecule::Removed);
}
Expand Down

0 comments on commit fe57183

Please sign in to comment.