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
This commit is contained in:
parent
0882acfe93
commit
925eb77c79
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue