From f0aede60522033859be46f077212d179ff5bfaa5 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Tue, 14 Jul 2020 12:11:48 +0100 Subject: [PATCH] elm_code: cursor visbility fix. If the widget is scrollable on the x axis, the cursor was being displayed in some rare cases when scrolling and the code widget did not cover the whole window region. e.g. a filepanel to the left of the widget could potentially have the cursor erroneously shown. This fixes as per the y axis hide. @fix --- src/lib/elementary/elm_code_widget.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index 870a73cee6..0507abd909 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -311,7 +311,7 @@ _elm_code_widget_fill_whitespace(Elm_Code_Widget *widget, Eina_Unicode character static void _elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd) { - Evas_Coord oy, oh; + Evas_Coord ox, oy, ow, oh; Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; elm_code_widget_geometry_for_position_get(widget, pd->cursor_line, pd->cursor_col, &cx, &cy, &cw, &ch); @@ -327,9 +327,9 @@ _elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd evas_object_smart_calculate(pd->scroller); evas_object_smart_calculate(pd->gridbox); - evas_object_geometry_get(widget, NULL, &oy, NULL, &oh); + evas_object_geometry_get(widget, &ox, &oy, &ow, &oh); - if ((cy < oy) || (cy > (oy + oh - ch))) + if ((cx < ox) || (cx > (ox + ow)) || (cy < oy) || (cy > (oy + oh - ch))) evas_object_hide(pd->cursor_rect); else { @@ -1198,7 +1198,6 @@ _elm_code_widget_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj _elm_code_widget_selection_type_set(widget, ELM_CODE_WIDGET_SELECTION_MOUSE); _elm_code_widget_selection_in_progress_set(widget, EINA_TRUE); - elm_code_widget_selection_end(widget, row, col); }