diff --git a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp index fc88b41c6..df0ae0875 100644 --- a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp +++ b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp @@ -38,13 +38,13 @@ AddTerminalStripCommand::~AddTerminalStripCommand() {} void AddTerminalStripCommand::undo() { - if (m_project && m_strip) { - m_project->addTerminalStrip(m_strip); - } + if (m_project && m_strip) { + m_project->removeTerminalStrip(m_strip); + } } void AddTerminalStripCommand::redo() { - if (m_project && m_strip) { - m_project->removeTerminalStrip(m_strip); - } + if (m_project && m_strip) { + m_project->addTerminalStrip(m_strip); + } } diff --git a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.h b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.h index 218e45599..495f92c3d 100644 --- a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.h +++ b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.h @@ -27,7 +27,7 @@ class QETProject; class AddTerminalStripCommand : public QUndoCommand { public: - AddTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent); + AddTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent = nullptr); ~AddTerminalStripCommand() override; void undo() override; diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 8b9ab3cb2..a32414e6e 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -1857,7 +1857,7 @@ bool QETProject::addTerminalStrip(TerminalStrip *strip) if (strip->parent() != this) return false; - if (!m_terminal_strip_vector.contains(strip)) + if (m_terminal_strip_vector.contains(strip)) return true; m_terminal_strip_vector.append(strip);