hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=925eb77c79a3b862d6edada14f8e93212d294163
commit 925eb77c79a3b862d6edada14f8e93212d294163 Author: Hermet Park <[email protected]> Date: Thu Jun 2 00:26:38 2016 +0900 edc_editor: compare name elaboratley to search the part correctly. when user press a part on the live view, the part name compareing is triggered. in that sequence, cursor is jump onto the part wrt clicked part. since, however, the string compare is not enough the cursor could go on other part which has a similar name. now compare them in detail to correct this @fix T3736 --- src/lib/edc_editor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c index adebb4b..2dc8a50 100644 --- a/src/lib/edc_editor.c +++ b/src/lib/edc_editor.c @@ -1055,16 +1055,14 @@ edit_part_cursor_set(edit_data *ed, const char *text = elm_entry_entry_get(ed->en_edit); char *utf8 = elm_entry_markup_to_utf8(text); - int part_name_size = strlen(part_name) + 2; // 2 - is quotes. - char *part_name_search = calloc(part_name_size + 1, sizeof(char)); + int part_name_size = strlen(part_name) + 3; // 2 - is quotes. + char *part_name_search = alloca(part_name_size); snprintf(part_name_search, part_name_size, "\"%s\"", part_name); - int group_name_size = strlen(group_name) + 2; // 2 - is quotes. - char *group_name_search = calloc(group_name_size + 1, sizeof(char)); + int group_name_size = strlen(group_name) + 3; // 2 - is quotes. + char *group_name_search = alloca(group_name_size); snprintf(group_name_search, group_name_size, "\"%s\"", group_name); - const char *group_pos = strstr(utf8, group_name_search); - if (!group_pos) return; char *itr = strstr(group_pos, part_name_search); const char *part_pos = itr; @@ -1158,8 +1156,6 @@ finish: } free(utf8); - free(part_name_search); - free(group_name_search); } void --
