nikawhite pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=39ddc2da33fc0674cb4ea082eb400a42456dff48

commit 39ddc2da33fc0674cb4ea082eb400a42456dff48
Author: Mykyta Biliavskyi <m.biliavs...@samsung.com>
Date:   Wed Dec 30 11:36:09 2015 +0900

    Templates: fix indention for generated "images" block
    
    fix T2971
---
 src/lib/template.c      | 17 ++++++++++++++++-
 src/lib/template_code.h | 11 +++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/lib/template.c b/src/lib/template.c
index f5200f9..2463d69 100644
--- a/src/lib/template.c
+++ b/src/lib/template.c
@@ -44,7 +44,22 @@ image_description_add(edit_data *ed)
      }
    else
      {
-        elm_entry_entry_insert(edit_entry, TEMPLATE_IMG_BLOCK);
+        int space = edit_cur_indent_depth_get(ed);
+
+        //Alloc Empty spaces
+        char *p = alloca(space + 1);
+        memset(p, ' ', space);
+        p[space] = '\0';
+
+        int i;
+        for (i = 0; i < (TEMPLATE_IMG_BLOCK_LINE_CNT - 1); i++)
+          {
+             elm_entry_entry_insert(edit_entry, p);
+             elm_entry_entry_insert(edit_entry, TEMPLATE_IMG_BLOCK[i]);
+          }
+        elm_entry_entry_insert(edit_entry, p);
+        elm_entry_entry_insert(edit_entry, TEMPLATE_IMG_BLOCK[i]);
+
         edit_line_increase(ed, TEMPLATE_IMG_BLOCK_LINE_CNT);
         cursor_pos2 = elm_entry_cursor_pos_get(edit_entry);
         edit_redoundo_region_push(ed, cursor_pos1, cursor_pos2);
diff --git a/src/lib/template_code.h b/src/lib/template_code.h
index 1a726fd..1cfea21 100644
--- a/src/lib/template_code.h
+++ b/src/lib/template_code.h
@@ -165,10 +165,13 @@ const char *TEMPLATE_IMG[TEMPLATE_IMG_LINE_CNT] =
 
 #define TEMPLATE_IMG_BLOCK_LINE_CNT 4
 
-const char *TEMPLATE_IMG_BLOCK = "/* TODO: Please replace embedded image files 
to your application image files. */<br/>"
-                                 "   images {<br/>"
-                                 "      image: \"ENVENTOR_EMBEDDED_LOGO.png\" 
COMP;<br/>"
-                                 "   }<br/>";
+const char *TEMPLATE_IMG_BLOCK[TEMPLATE_IMG_BLOCK_LINE_CNT] =
+{
+   "/* TODO: Please replace embedded image files to your application image 
files. */<br/>",
+   "images {<br/>",
+   "   image: \"ENVENTOR_EMBEDDED_LOGO.png\" COMP;<br/>",
+   "}<br/>"
+};
 
 #define TEMPLATE_TEXTBLOCK_STYLE_LINE_CNT 3
 

-- 


Reply via email to