diff --git a/avogadro/qtplugins/copypaste/copypaste.cpp b/avogadro/qtplugins/copypaste/copypaste.cpp index 50d47ddf5d..3903f6f1c7 100644 --- a/avogadro/qtplugins/copypaste/copypaste.cpp +++ b/avogadro/qtplugins/copypaste/copypaste.cpp @@ -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); }