jaehyun pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=503afcc4c52dad660a99435a776676238d254055
commit 503afcc4c52dad660a99435a776676238d254055 Author: Jaehyun Cho <jae_hyun....@samsung.com> Date: Wed Feb 17 20:02:39 2016 +0900 indent: Fix not to insert a new line within macro Do not insert a new line after '{', '}', ';' if it is within macro. <Test Case> 1. Copy the following in edc. "#define FN_COL_DEFAULT 255 255 255 255; color3: 0 0 0 128" 2. Paste <Test Result> Previously, a new line is inserted after ';' within the macro. Now, the same text with the copied text is pasted. --- src/lib/indent.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/lib/indent.c b/src/lib/indent.c index 95dc435..8a891d7 100644 --- a/src/lib/indent.c +++ b/src/lib/indent.c @@ -259,6 +259,7 @@ indent_text_auto_format(indent_data *id EINA_UNUSED, Eina_Bool keep_lexem_start_pos = EINA_FALSE; Eina_Bool single_comment_found = EINA_FALSE; Eina_Bool multi_comment_found = EINA_FALSE; + Eina_Bool macro_found = EINA_FALSE; int tb_cur_pos = 0; /* Create a list of code line strings from inserted string. @@ -286,6 +287,12 @@ indent_text_auto_format(indent_data *id EINA_UNUSED, if (single_comment_found || multi_comment_found) utf8_ptr += 2; } + //Check macro. + if (*utf8_ptr == '#') + { + macro_found = EINA_TRUE; + utf8_ptr++; + } while (utf8_ptr < utf8_end) { @@ -295,6 +302,15 @@ indent_text_auto_format(indent_data *id EINA_UNUSED, if (single_comment_found) single_comment_found = EINA_FALSE; + //End of macro. + else if (macro_found) + { + //Macro ends with "\n" but continues with "\\\n". + if (!(utf8_ptr - 1 >= utf8 && + *(utf8_ptr - 1) == '\\')) + macro_found = EINA_FALSE; + } + code_lines = eina_list_append(code_lines, eina_stringshare_add_length(utf8_lexem, utf8_ptr - utf8_lexem)); @@ -320,8 +336,8 @@ indent_text_auto_format(indent_data *id EINA_UNUSED, break; } } - //No line comment. - else if (!single_comment_found) + //No line comment and No macro. + else if (!single_comment_found && !macro_found) { if (*utf8_ptr == '{' || *utf8_ptr == '}' || *utf8_ptr == ';') --