summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-07-25 23:54:21 +0100
committerAndy Williams <andy@andywilliams.me>2017-07-25 23:54:21 +0100
commit77db870b6150d6f1bbc0ba6185bd3e14dd217c6b (patch)
tree84a4ed201bd5e69f3c98afe6a4d5c78d1fb902e3
parent69c6cbfdf19c032f32cbf7d39e2136856ceea5b1 (diff)
elm_code: Fix missing middle button selection paste
Resolves task T5520 @fix
-rw-r--r--src/lib/elementary/elm_code_widget.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 04f20edcd6..2846959f7c 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -969,6 +969,24 @@ _elm_code_widget_clicked_readonly_cb(Elm_Code_Widget *widget, unsigned int row)
969} 969}
970 970
971static void 971static void
972_mouse_selection_paste_at_position(Elm_Code_Widget *widget,
973 unsigned int row, unsigned int col)
974{
975 char *text;
976
977 if (elm_code_widget_selection_is_empty(widget))
978 return;
979
980 text = elm_code_widget_selection_text_get(widget);
981 elm_code_widget_selection_clear(widget);
982
983 elm_code_widget_cursor_position_set(widget, row, col);
984 elm_code_widget_text_at_cursor_insert(widget, text);
985
986 free(text);
987}
988
989static void
972_elm_code_widget_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 990_elm_code_widget_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
973 void *event_info) 991 void *event_info)
974{ 992{
@@ -986,10 +1004,18 @@ _elm_code_widget_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj
986 1004
987 ctrl = evas_key_modifier_is_set(event->modifiers, "Control"); 1005 ctrl = evas_key_modifier_is_set(event->modifiers, "Control");
988 shift = evas_key_modifier_is_set(event->modifiers, "Shift"); 1006 shift = evas_key_modifier_is_set(event->modifiers, "Shift");
989 if (event->button == 3 && !ctrl) 1007 if (!ctrl)
990 { 1008 {
991 _popup_menu_show(widget, event->canvas.x, event->canvas.y); 1009 if (event->button == 3)
992 return; 1010 {
1011 _popup_menu_show(widget, event->canvas.x, event->canvas.y);
1012 return;
1013 }
1014 else if (event->button == 2)
1015 {
1016 _mouse_selection_paste_at_position(widget, row, col);
1017 return;
1018 }
993 } 1019 }
994 1020
995 if (!shift) 1021 if (!shift)