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
This commit is contained in:
Alastair Poole 2020-07-14 12:11:48 +01:00
parent 9f7fde560a
commit f0aede6052
1 changed files with 3 additions and 4 deletions

View 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);
}