hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=8dcd605806a996e3145d9ae2a2b6891d1b114a1f
commit 8dcd605806a996e3145d9ae2a2b6891d1b114a1f Author: ChunEon Park <her...@hermet.pe.kr> Date: Tue Mar 11 00:01:23 2014 +0900 editor - now u can delete a current line with Ctrl+D --- README | 1 + src/bin/edc_editor.c | 32 ++++++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README b/README index da55d63..55494e6 100644 --- a/README +++ b/README @@ -68,6 +68,7 @@ Ctrl+Double Click = Select a word Ctrl+C = Copy Selected Text Ctrl+V = Paste Copied Text Ctrl+X = Cut Selected Text +Ctrl+D = Delete a Current line Ctrl+F = Find/Replace Ctrl+Home = Go to the Top line Ctrl+End = Go to the Bottom line diff --git a/src/bin/edc_editor.c b/src/bin/edc_editor.c index dac46d8..04e2358 100644 --- a/src/bin/edc_editor.c +++ b/src/bin/edc_editor.c @@ -64,6 +64,8 @@ line_decrease(edit_data *ed, int cnt) elm_entry_calc_force(ed->en_line); ed->line_max -= cnt; + + if (ed->line_max < 0) ed->line_max = 0; } static void @@ -400,14 +402,14 @@ edit_mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, static void cur_line_pos_set(edit_data *ed) { - if (!config_stats_bar_get()) return; - Evas_Coord y, h; elm_entry_cursor_geometry_get(ed->en_edit, NULL, &y, NULL, &h); int line = (y / h) + 1; if (line < 0) line = 0; if (ed->cur_line == line) return; ed->cur_line = line; + + if (!config_stats_bar_get()) return; stats_line_num_update(ed->cur_line, ed->line_max); } @@ -636,23 +638,41 @@ edit_line_delete(edit_data *ed) int line1 = ed->cur_line - 1; int line2 = ed->cur_line; + //min position case if (line1 < 0) { - line1++; - line2++; + line1 = 0; + line2 = 1; + } + + //Max position case + Eina_Bool max = EINA_FALSE; + if (line2 >= ed->line_max) + { + line1 = (ed->line_max - 2); + line2 = (ed->line_max - 1); + max = EINA_TRUE; + } + + //only one line remain. clear it. + if (ed->line_max == 1) + { + elm_entry_entry_set(ed->en_edit, ""); + line_decrease(ed, 1); + return; } Evas_Textblock_Cursor *cur1 = evas_object_textblock_cursor_new(textblock); evas_textblock_cursor_line_set(cur1, line1); + if (max) evas_textblock_cursor_line_char_last(cur1); Evas_Textblock_Cursor *cur2 = evas_object_textblock_cursor_new(textblock); evas_textblock_cursor_line_set(cur2, line2); + if (max) evas_textblock_cursor_line_char_last(cur2); 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); --