ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ed201d7f30eeaf70a3546686c4f3d3262f62eef6
commit ed201d7f30eeaf70a3546686c4f3d3262f62eef6 Author: Sanjeev BA <iamsanj...@gmail.com> Date: Sat Jun 17 17:16:24 2017 +0100 Add support for select all with ctrl-a Summary: Signed-off-by: Sanjeev BA <iamsanj...@gmail.com> Test Plan: Test with edi. Reviewers: ajwillia.ms, jpeg, cedric Reviewed By: ajwillia.ms Differential Revision: https://phab.enlightenment.org/D4971 --- src/lib/elementary/elm_code_widget.c | 2 ++ src/lib/elementary/elm_code_widget_selection.c | 16 ++++++++++++++++ src/lib/elementary/elm_code_widget_selection.h | 3 +++ 3 files changed, 21 insertions(+) diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index f572ef3b32..436dd27cc0 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -1536,6 +1536,8 @@ _elm_code_widget_control_key_down_cb(Elm_Code_Widget *widget, const char *key) elm_code_widget_redo(widget); else if (!strcmp("z", key)) elm_code_widget_undo(widget); + else if (!strcmp("a", key)) + elm_code_widget_selection_select_all(widget); } static Eina_Bool diff --git a/src/lib/elementary/elm_code_widget_selection.c b/src/lib/elementary/elm_code_widget_selection.c index 073911cfdd..ea2e584b69 100644 --- a/src/lib/elementary/elm_code_widget_selection.c +++ b/src/lib/elementary/elm_code_widget_selection.c @@ -88,6 +88,22 @@ elm_code_widget_selection_end(Evas_Object *widget, efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget); } +EAPI void +elm_code_widget_selection_select_all(Evas_Object *widget) +{ + Elm_Code_Widget_Data *pd; + Elm_Code_Widget_Selection_Data *selection; + + pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); + + elm_code_widget_selection_start(widget, 0, 0); + int maxrow = elm_code_file_lines_get(pd->code->file); + elm_code_widget_selection_end(widget, maxrow, pd->col_count); + + efl_event_callback_legacy_call(widget, ELM_OBJ_CODE_WIDGET_EVENT_SELECTION_CHANGED, widget); +} + + EAPI Elm_Code_Widget_Selection_Data * elm_code_widget_selection_normalized_get(Evas_Object *widget) { diff --git a/src/lib/elementary/elm_code_widget_selection.h b/src/lib/elementary/elm_code_widget_selection.h index 9fe7e5c588..57f2f9d050 100644 --- a/src/lib/elementary/elm_code_widget_selection.h +++ b/src/lib/elementary/elm_code_widget_selection.h @@ -35,6 +35,9 @@ EAPI void elm_code_widget_selection_paste(Evas_Object *widget); EAPI Eina_Bool elm_code_widget_selection_is_empty(Evas_Object *widget); +EAPI void elm_code_widget_selection_select_all(Evas_Object *widget); + + /** * @} */ --