jaehyun pushed a commit to branch master.

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

commit b5e27c58d6cfcc012a896581de7b5e066b679693
Author: Jaehyun Cho <[email protected]>
Date:   Tue Aug 9 20:59:07 2016 +0900

    syntax_indent: Fix not to paste string redundantly.
    
    Previously, indentation logic produced a duplicated string if the copied
    string ends with spaces.
    
    Test Plan:
    1. Open basic template.
    2. Cut string right before "}" in the text view.
       (e.g. Copy from 5th line to 7th line right before "}" in basic edc.)
    3. Paste the cut string.
    4. See that 6th line's string is pasted redundantly.
---
 src/lib/syntax_indent.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/lib/syntax_indent.c b/src/lib/syntax_indent.c
index b60b9fa..b255600 100644
--- a/src/lib/syntax_indent.c
+++ b/src/lib/syntax_indent.c
@@ -350,11 +350,20 @@ indent_code_line_list_create(indent_data *id EINA_UNUSED, 
const char *utf8)
         else
           {
              if (!append_begin)
-               append_begin = utf8_lexem;
-
-             //Newline only string does not need indentation.
-             if ((*append_begin == '\n') && (append_begin == utf8_end - 1))
-               code_line->indent_apply = EINA_FALSE;
+               {
+                  //Only spaces are in the rest of the input string.
+                  if (utf8_lexem <= utf8_appended)
+                    {
+                       append_begin = utf8_appended + 1;
+                       code_line->indent_apply = EINA_FALSE;
+                    }
+                  //Non-space characters are in the rest of the input string.
+                  else
+                    {
+                       append_begin = utf8_lexem;
+                       code_line->indent_apply = EINA_TRUE;
+                    }
+               }
              else
                code_line->indent_apply = EINA_TRUE;
           }

-- 


Reply via email to