enventor - on implementing line deletion.
This commit is contained in:
parent
21edebb1d3
commit
edbf669979
|
@ -51,7 +51,6 @@ line_decrease(edit_data *ed, int cnt)
|
|||
Evas_Object *textblock = elm_entry_textblock_get(ed->en_line);
|
||||
Evas_Textblock_Cursor *cur1 = evas_object_textblock_cursor_new(textblock);
|
||||
evas_textblock_cursor_line_set(cur1, (ed->line_max - cnt));
|
||||
evas_textblock_cursor_word_start(cur1);
|
||||
|
||||
Evas_Textblock_Cursor *cur2 = evas_object_textblock_cursor_new(textblock);
|
||||
evas_textblock_cursor_line_set(cur2, ed->line_max);
|
||||
|
@ -627,6 +626,38 @@ edit_view_sync_cb_set(edit_data *ed,
|
|||
ed->view_sync_cb_data = data;
|
||||
}
|
||||
|
||||
void
|
||||
edit_line_delete(edit_data *ed)
|
||||
{
|
||||
if (!elm_object_focus_get(ed->en_edit)) return;
|
||||
|
||||
Evas_Object *textblock = elm_entry_textblock_get(ed->en_edit);
|
||||
|
||||
int line1 = ed->cur_line - 1;
|
||||
int line2 = ed->cur_line;
|
||||
|
||||
if (line1 < 0)
|
||||
{
|
||||
line1++;
|
||||
line2++;
|
||||
}
|
||||
|
||||
Evas_Textblock_Cursor *cur1 = evas_object_textblock_cursor_new(textblock);
|
||||
evas_textblock_cursor_line_set(cur1, line1);
|
||||
|
||||
Evas_Textblock_Cursor *cur2 = evas_object_textblock_cursor_new(textblock);
|
||||
evas_textblock_cursor_line_set(cur2, line2);
|
||||
|
||||
evas_textblock_cursor_range_delete(cur1, cur2);
|
||||
|
||||
evas_textblock_cursor_free(cur1);
|
||||
evas_textblock_cursor_free(cur2);
|
||||
|
||||
elm_entry_calc_force(ed->en_edit);
|
||||
|
||||
line_decrease(ed, 1);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
key_down_cb(void *data, int type EINA_UNUSED, void *ev)
|
||||
{
|
||||
|
|
|
@ -147,6 +147,12 @@ ctrl_func(app_data *ad, const char *key)
|
|||
//Go to Begin/End
|
||||
if (!strcmp(key, "Home") || !strcmp(key, "End"))
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
//Delete Line
|
||||
if (!strcmp(key, "d") || !strcmp(key, "D"))
|
||||
{
|
||||
edit_line_delete(ad->ed);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
//Find/Replace
|
||||
if (!strcmp(key, "f") || !strcmp(key, "F"))
|
||||
{
|
||||
|
|
|
@ -15,3 +15,4 @@ void edit_font_size_update(edit_data *ed, Eina_Bool msg);
|
|||
void edit_template_insert(edit_data *ed);
|
||||
void edit_template_part_insert(edit_data *ed, Edje_Part_Type type);
|
||||
void edit_part_highlight_toggle(edit_data *ed, Eina_Bool msg);
|
||||
void edit_line_delete(edit_data *ed);
|
||||
|
|
Loading…
Reference in New Issue