From 50bf9fb1c43324b6997ae795f6a0ab0ca8bbdb93 Mon Sep 17 00:00:00 2001 From: joncruz Date: Sun, 27 Apr 2008 08:41:25 +0000 Subject: [PATCH] Reduce undo history items when nothing is selected --- src/eraser-context.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp index 3d142a9d0..c787f0799 100644 --- a/src/eraser-context.cpp +++ b/src/eraser-context.cpp @@ -790,6 +790,7 @@ static void set_to_accumulated(SPEraserContext *dc) { SPDesktop *desktop = SP_EVENT_CONTEXT(dc)->desktop; + bool workDone = false; if (!sp_curve_empty(dc->accumulated)) { NArtBpath *abp; @@ -838,6 +839,7 @@ set_to_accumulated(SPEraserContext *dc) selection->set(item); selection->add(dup); sp_selected_path_diff_skip_undo(); + workDone = true; // TODO set this only if something was cut. if ( !selection->isEmpty() ) { // If the item was not completely erased, add it back to the selection. GSList const *selected2 = g_slist_copy(const_cast(selection->itemList())); @@ -869,8 +871,13 @@ set_to_accumulated(SPEraserContext *dc) } } - sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER, - _("Draw eraser stroke")); + + if ( workDone ) { + sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ERASER, + _("Draw eraser stroke")); + } else { + sp_document_cancel(sp_desktop_document(desktop)); + } } static void -- 2.30.2