rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=557473468f2de9cac9f0ba83d62f43822e797a64

commit 557473468f2de9cac9f0ba83d62f43822e797a64
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Mon Feb 1 15:50:32 2016 +0200

    editor: fix abort on redoing part rename
---
 src/bin/editor/diff.c        | 13 +++++++++++++
 src/bin/editor/diff.h        |  1 +
 src/bin/editor/editor_part.c |  4 ++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/bin/editor/diff.c b/src/bin/editor/diff.c
index 740fbc9..d528c07 100644
--- a/src/bin/editor/diff.c
+++ b/src/bin/editor/diff.c
@@ -127,6 +127,7 @@ _apply(Evas_Object *obj, Function_Info *fi)
          return ((function_type_string_int)fi->function)(obj, NULL, false,
                   fi->args.type_si.s1, fi->args.type_si.i2);
       case FUNCTION_TYPE_STRING_STRING:
+      case FUNCTION_TYPE_STRING_STRING_RENAME:
          return ((function_type_string_string)fi->function)(obj, NULL, false,
                   fi->args.type_ss.s1, fi->args.type_ss.s2);
       case FUNCTION_TYPE_STRING:
@@ -288,6 +289,17 @@ diff_update(Diff *diff, Diff *new_diff)
          eina_stringshare_ref(new_diff->redo.args.type_ss.s1);
          eina_stringshare_ref(new_diff->redo.args.type_ss.s2);
          break;
+      case FUNCTION_TYPE_STRING_STRING_RENAME:
+         /* rename needs special update */
+         assert(diff->redo.type == diff->undo.type);
+
+         eina_stringshare_del(diff->undo.args.type_ss.s1);
+         diff->undo.args.type_ss.s1 = 
eina_stringshare_ref(new_diff->undo.args.type_ss.s1);
+         eina_stringshare_del(diff->redo.args.type_ss.s2);
+         diff->redo.args.type_ss.s2 = 
eina_stringshare_ref(new_diff->redo.args.type_ss.s2);
+         diff_free(new_diff);
+         /* using return because we don't want to replace redo field */
+         return;
       case FUNCTION_TYPE_STRING:
          eina_stringshare_del(diff->redo.args.type_s.s1);
          eina_stringshare_ref(new_diff->redo.args.type_s.s1);
@@ -428,6 +440,7 @@ diff_free(Diff *diff)
          eina_stringshare_del(diff->redo.args.type_si.s1);
          break;
       case FUNCTION_TYPE_STRING_STRING:
+      case FUNCTION_TYPE_STRING_STRING_RENAME:
          eina_stringshare_del(diff->redo.args.type_ss.s1);
          eina_stringshare_del(diff->redo.args.type_ss.s2);
          break;
diff --git a/src/bin/editor/diff.h b/src/bin/editor/diff.h
index 9d957fb..c488071 100644
--- a/src/bin/editor/diff.h
+++ b/src/bin/editor/diff.h
@@ -38,6 +38,7 @@ typedef enum {
    FUNCTION_TYPE_STRING_BOOL,
    FUNCTION_TYPE_STRING_INT,
    FUNCTION_TYPE_STRING_STRING,
+   FUNCTION_TYPE_STRING_STRING_RENAME,
    FUNCTION_TYPE_STRING,
    FUNCTION_TYPE_STRING_STRING_EDJEASPECTCONTROL,
    FUNCTION_TYPE_STRING_STRING_DOUBLE,
diff --git a/src/bin/editor/editor_part.c b/src/bin/editor/editor_part.c
index 9313b8d..accf84e 100644
--- a/src/bin/editor/editor_part.c
+++ b/src/bin/editor/editor_part.c
@@ -124,11 +124,11 @@ editor_part_name_set(Evas_Object *edit_object, Change 
*change, Eina_Bool merge,
    if (change)
      {
         diff = mem_calloc(1, sizeof(Diff));
-        diff->redo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->redo.type = FUNCTION_TYPE_STRING_STRING_RENAME;
         diff->redo.function = editor_part_name_set;
         diff->redo.args.type_ss.s1 = eina_stringshare_add(name);
         diff->redo.args.type_ss.s2 = eina_stringshare_add(new_val);
-        diff->undo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->undo.type = FUNCTION_TYPE_STRING_STRING_RENAME;
         diff->undo.function = editor_part_name_set;
         diff->undo.args.type_ss.s1 = eina_stringshare_add(new_val);
         diff->undo.args.type_ss.s2 = eina_stringshare_add(name);

-- 


Reply via email to