hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=7892ce8dd546e26c9a32736198baf15f340bb044
commit 7892ce8dd546e26c9a32736198baf15f340bb044 Author: ChunEon Park <[email protected]> Date: Wed May 14 15:59:49 2014 +0900 editor - fix buggy line number displaying. don't be clean up line numbers even edc text is clear. the minimum line number should be 1. --- src/bin/edc_editor.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/bin/edc_editor.c b/src/bin/edc_editor.c index 0b2af42..9f1982d 100644 --- a/src/bin/edc_editor.c +++ b/src/bin/edc_editor.c @@ -35,6 +35,16 @@ static Eina_Bool image_preview_show(edit_data *ed, char *cur, Evas_Coord x, Evas_Coord y); static void +line_init(edit_data *ed) +{ + char buf[MAX_LINE_DIGIT_CNT]; + + ed->line_max = 1; + snprintf(buf, sizeof(buf), "%d", ed->line_max); + elm_entry_entry_set(ed->en_line, buf); +} + +static void line_increase(edit_data *ed) { char buf[MAX_LINE_DIGIT_CNT]; @@ -670,7 +680,7 @@ edit_line_delete(edit_data *ed) if (ed->line_max == 1) { elm_entry_entry_set(ed->en_edit, ""); - line_decrease(ed, 1); + line_init(ed); return; } @@ -821,6 +831,8 @@ edit_edc_read(edit_data *ed, const char *file_path) { char buf[MAX_LINE_DIGIT_CNT]; + ed->line_max = 0; + Eina_File *file = eina_file_open(file_path, EINA_FALSE); if (!file) goto err; @@ -872,6 +884,8 @@ edit_edc_read(edit_data *ed, const char *file_path) ecore_animator_add(syntax_color_timer_cb, ed); err: + //Even any text is not inserted, line number should start with 1 + if (ed->line_max == 0) line_init(ed); if (strbuf_edit) eina_strbuf_free(strbuf_edit); if (strbuf_line) eina_strbuf_free(strbuf_line); if (itr) eina_iterator_free(itr); --
