diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 74a0475da3..3f33b882e8 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -938,8 +938,11 @@ int Application::setActiveTransaction(const char *name, bool persist) { FC_LOG("transaction rename to '" << name << "'"); for(auto &v : DocMap) v.second->renameTransaction(name,_activeTransactionID); - }else + } else { + if(persist) + AutoTransaction::setEnable(false); return 0; + } }else{ FC_LOG("set active transaction '" << name << "'"); _activeTransactionID = 0; diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 720507b241..ee630a157b 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -394,6 +394,7 @@ void Command::invoke(int i, TriggerSource trigger) // check if it really works NOW (could be a delay between click deactivation of the button) if (isActive()) { auto manager = getGuiApplication()->macroManager(); + auto editDoc = getGuiApplication()->editDocument(); if(!disabler) activated( i ); else { @@ -426,6 +427,10 @@ void Command::invoke(int i, TriggerSource trigger) } } getMainWindow()->updateActions(); + + // If this command starts an editing, let the transaction persist + if(!editDoc && getGuiApplication()->editDocument()) + committer.setEnable(false); } } catch (const Base::SystemExitException&) { diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 122d789b42..4933aec7ad 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1304,6 +1304,7 @@ void TreeWidget::mouseDoubleClickEvent (QMouseEvent * event) objitem->getOwnerDocument()->document()->setActiveView(objitem->object()); auto manager = Application::Instance->macroManager(); auto lines = manager->getLines(); + auto editDoc = Application::Instance->editDocument(); App::AutoTransaction committer("Double click", true); std::ostringstream ss; ss << Command::getObjectCmd(objitem->object()->getObject()) @@ -1312,6 +1313,10 @@ void TreeWidget::mouseDoubleClickEvent (QMouseEvent * event) QTreeWidget::mouseDoubleClickEvent(event); else if(lines == manager->getLines()) manager->addLine(MacroManager::Gui,ss.str().c_str()); + + // If the double click starts an editing, let the transaction persist + if(!editDoc && Application::Instance->editDocument()) + committer.setEnable(false); } }