nikawhite pushed a commit to branch master.

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

commit fbc8111b5679aa6a658f752e2648a92a9602ab36
Author: Mykyta Biliavskyi <m.biliavs...@samsung.com>
Date:   Wed Dec 30 14:35:25 2015 +0900

    Template:  fix indention for generated "styles" block.
    
    @fix T2973
---
 src/lib/template.c      | 24 ++++++++++++++++++++++--
 src/lib/template_code.h | 12 ++++++------
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/lib/template.c b/src/lib/template.c
index 2463d69..995260f 100644
--- a/src/lib/template.c
+++ b/src/lib/template.c
@@ -81,17 +81,37 @@ textblock_style_add(edit_data *ed, const char *style_name)
    elm_entry_cursor_line_begin_set(edit_entry);
    int cursor_pos1 = elm_entry_cursor_pos_get(edit_entry);
 
+   int space = edit_cur_indent_depth_get(ed);
+   if (styles_block)
+      space -= TAB_SPACE;
+
+   //Alloc Empty spaces
+   char *p = alloca(space + 1);
+   memset(p, ' ', space);
+   p[space] = '\0';
+
    if (!styles_block)
-     elm_entry_entry_insert(edit_entry, TEMPLATE_TEXTBLOCK_STYLE_BLOCK[0]);
+     {
+        elm_entry_entry_insert(edit_entry, p);
+        elm_entry_entry_insert(edit_entry, TEMPLATE_TEXTBLOCK_STYLE_BLOCK[0]);
+     }
 
    int buf_len = strlen(TEMPLATE_TEXTBLOCK_STYLE_BLOCK[1]) + 
strlen(style_name);
    char *buf = malloc(buf_len);
    snprintf(buf, buf_len, TEMPLATE_TEXTBLOCK_STYLE_BLOCK[1], style_name);
+   elm_entry_entry_insert(edit_entry, p);
    elm_entry_entry_insert(edit_entry, buf);
+   elm_entry_entry_insert(edit_entry, p);
+   elm_entry_entry_insert(edit_entry, TEMPLATE_TEXTBLOCK_STYLE_BLOCK[2]);
+   elm_entry_entry_insert(edit_entry, p);
+   elm_entry_entry_insert(edit_entry, TEMPLATE_TEXTBLOCK_STYLE_BLOCK[3]);
    free(buf);
 
    if (!styles_block)
-     elm_entry_entry_insert(edit_entry, TEMPLATE_TEXTBLOCK_STYLE_BLOCK[2]);
+     {
+       elm_entry_entry_insert(edit_entry, p);
+       elm_entry_entry_insert(edit_entry, TEMPLATE_TEXTBLOCK_STYLE_BLOCK[4]);
+     }
 
    int line_inc = TEMPLATE_TEXTBLOCK_STYLE_LINE_CNT;
    if (!styles_block) line_inc += 2;
diff --git a/src/lib/template_code.h b/src/lib/template_code.h
index 1cfea21..68eca54 100644
--- a/src/lib/template_code.h
+++ b/src/lib/template_code.h
@@ -173,14 +173,14 @@ const char 
*TEMPLATE_IMG_BLOCK[TEMPLATE_IMG_BLOCK_LINE_CNT] =
    "}<br/>"
 };
 
-#define TEMPLATE_TEXTBLOCK_STYLE_LINE_CNT 3
+#define TEMPLATE_TEXTBLOCK_STYLE_LINE_CNT 5
 
 const char *TEMPLATE_TEXTBLOCK_STYLE_BLOCK[TEMPLATE_TEXTBLOCK_STYLE_LINE_CNT] =
 {
-   "   styles {<br/>",
-   "      style { \"%s\";<br/>"
-   "         base: \"font=\"Sans\" font_size=30 text_class=entry color=#0088AA 
style=shadow,bottom shadow_color=#00000080 valign=0.5 ellipsis=1.0 wrap=none 
align=center\";<br/>"
-   "      }<br/>",
-   "   }<br/>"
+   "styles {<br/>",
+   "   style { \"%s\";<br/>",
+   "      base: \"font=\"Sans\" font_size=30 text_class=entry color=#0088AA 
style=shadow,bottom shadow_color=#00000080 valign=0.5 ellipsis=1.0 wrap=none 
align=center\";<br/>",
+   "   }<br/>",
+   "}<br/>"
 };
 

-- 


Reply via email to