From: joncruz Date: Sun, 27 Apr 2008 08:41:25 +0000 (+0000) Subject: Reduce undo history items when nothing is selected X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=50bf9fb1c43324b6997ae795f6a0ab0ca8bbdb93;p=inkscape.git Reduce undo history items when nothing is selected --- 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