View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012308 | Scribus | Undo/Redo | public | 2014-05-14 15:46 | 2026-08-29 01:50 |
| Reporter | FirasH | Assigned To | cbradney | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Platform | x86_64 | OS | openSUSE | OS Version | 13.1 |
| Product Version | 1.4.4.svn | ||||
| Target Version | 1.5.5 | Fixed in Version | 1.7.4.svn | ||
| Summary | 0012308: Undo/Redo records useless entries deleting guides from Guide Manager | ||||
| Description | Undo/Redo keeps adding new entries in "Action History" each time the button to delete guides is pressed (even if none present). | ||||
| Steps To Reproduce | 0) Create a new document and make sure Windows > "Action History" is opened 1) Open: Page > Manage Guides... 2) Select "Misc" tab 3) Click a few times on: - Delete Guides from Current Page - Delete Guides from All Pages Each time a new entry is added in "Action History". | ||||
| Additional Information | Issue present on: Scribus 1.4.4 SVN (19119) Scribus 1.5.0 SVN (19120) | ||||
| Tags | No tags attached. | ||||
| Patch | |||||
|
|
Confirmed 1.5svn r19352 (OSX) >" I suggest to add new "Action History" entries only when one or more guides are deleted. For example if you press 2 times (keeping selected the same page) "Delete Guides from Current Page" only the first time is saved." Agree with FirasH, fixing it is more tidy and I imagine less subject to creating bugs/unstable behavior in the future. |
|
|
Still hanging quietly. Here is the very small patch that fixed it in my testing. #Issue: Deleting guides from Current Page or All Pages recorded Undo/Action History entries even when there were no guides to delete. #Also affected: These no-op actions could still mark the document as modified, despite making no document change. #Fix: Skip guide deletion entirely when the target page(s) contain no standard or automatic guides, and avoid creating Auto-guide Undo states when their settings are already empty. #Result: No useless Action History entries, no false modified state, and repeated clicks on the delete buttons are true no-ops. delete-empty-guides-undo-v1.0.patch (2,483 bytes)
Index: scribus/guidemanagercore.cpp
===================================================================
--- scribus/guidemanagercore.cpp (revision 27785)
+++ scribus/guidemanagercore.cpp (working copy)
@@ -314,6 +314,10 @@
m_horizontalStdG.clear();
break;
case Auto:
+ if (m_horizontalAutoGap == 0.0 && m_horizontalAutoCount == 0 &&
+ m_horizontalAutoRefer == 0 && m_horizontalAutoG.isEmpty())
+ break;
+
if (UndoManager::undoEnabled())
{
auto* ss = new SimpleState(Um::DelHAGuide, nullptr, Um::IGuides);
@@ -348,6 +352,10 @@
m_verticalStdG.clear();
break;
case Auto:
+ if (m_verticalAutoGap == 0.0 && m_verticalAutoCount == 0 &&
+ m_verticalAutoRefer == 0 && m_verticalAutoG.isEmpty())
+ break;
+
if (UndoManager::undoEnabled())
{
auto* ss = new SimpleState(Um::DelVAGuide, nullptr, Um::IGuides);
Index: scribus/ui/guidemanager.cpp
===================================================================
--- scribus/ui/guidemanager.cpp (revision 27785)
+++ scribus/ui/guidemanager.cpp (working copy)
@@ -35,6 +35,26 @@
#include "undomanager.h"
#include "units.h"
+namespace
+{
+bool pageHasGuides(const ScPage* page)
+{
+ if (!page)
+ return false;
+
+ const GuideManagerCore& guides = page->guides;
+ return !guides.horizontals(GuideManagerCore::Standard).isEmpty()
+ || !guides.verticals(GuideManagerCore::Standard).isEmpty()
+ || !guides.horizontals(GuideManagerCore::Auto).isEmpty()
+ || !guides.verticals(GuideManagerCore::Auto).isEmpty()
+ || guides.horizontalAutoCount() != 0
+ || guides.verticalAutoCount() != 0
+ || guides.horizontalAutoGap() != 0.0
+ || guides.verticalAutoGap() != 0.0
+ || guides.horizontalAutoRefer() != 0
+ || guides.verticalAutoRefer() != 0;
+}
+}
GuideManager::GuideManager(QWidget* parent) :
ScrPaletteBase(parent, "GuideManager")
@@ -486,6 +506,9 @@
void GuideManager::deletePageButton_clicked()
{
+ if (!pageHasGuides(currentPage))
+ return;
+
UndoTransaction trans;
if(UndoManager::undoEnabled())
trans = UndoManager::instance()->beginTransaction(currentPage->getUName(),
@@ -517,6 +540,18 @@
void GuideManager::deleteAllGuides_clicked()
{
+ bool hasGuides = false;
+ for (const ScPage* page : *m_doc->Pages)
+ {
+ if (pageHasGuides(page))
+ {
+ hasGuides = true;
+ break;
+ }
+ }
+ if (!hasGuides)
+ return;
+
UndoTransaction trans;
if (UndoManager::undoEnabled())
trans = UndoManager::instance()->beginTransaction(m_doc->getUName(),
|
|
|
Thanks, committed my own version of the required changes |
|
|
Thanks, @cbradney. I hope mine was helpful at least. :) |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2014-05-14 15:46 | FirasH | New Issue | |
| 2014-07-19 12:28 | Kunda | Relationship added | related to 0012425 |
| 2014-07-19 12:34 | Kunda | Note Added: 0032833 | |
| 2014-07-19 12:34 | Kunda | Status | new => confirmed |
| 2014-07-19 12:34 | Kunda | Target Version | => 1.5.1 |
| 2014-07-19 12:34 | Kunda | Steps to Reproduce Updated | |
| 2015-11-29 13:55 | Kunda | Target Version | 1.5.1 => 1.5.2 |
| 2016-01-23 17:14 | cbradney | Target Version | 1.5.2 => 1.5.3 |
| 2016-01-23 17:15 | cbradney | Target Version | 1.5.3 => 1.5.4.svn |
| 2016-12-08 21:32 | Kunda | Target Version | 1.5.4.svn => 1.5.5 |
| 2016-12-08 22:08 | Kunda | Relationship added | child of 0012500 |
| 2019-10-25 11:29 | ale | Relationship added | related to 0015874 |
| 2026-08-28 07:27 | qirat | Note Added: 0054354 | |
| 2026-08-28 07:27 | qirat | File Added: delete-empty-guides-undo-v1.0.patch | |
| 2026-08-28 07:27 | qirat | Tag Attached: #please_test | |
| 2026-08-28 08:26 | cbradney | Assigned To | => cbradney |
| 2026-08-28 08:26 | cbradney | Status | confirmed => resolved |
| 2026-08-28 08:26 | cbradney | Resolution | open => fixed |
| 2026-08-28 08:26 | cbradney | Fixed in Version | => 1.7.4.svn |
| 2026-08-28 08:26 | cbradney | Note Added: 0054355 | |
| 2026-08-28 08:49 | qirat | Note Added: 0054356 | |
| 2026-08-29 01:50 | qirat | Tag Detached: #please_test |