elm_code: cursor visbility fix.
authorAlastair Poole <netstar@gmail.com>
Tue, 14 Jul 2020 11:11:48 +0000 (12:11 +0100)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 14 Jul 2020 22:29:17 +0000 (07:29 +0900)
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

index 870a73c..0507abd 100644 (file)
@@ -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);
 }