termio: hide links when content change underneath
This commit is contained in:
parent
225b14a54f
commit
d5d61a5b76
|
@ -31,7 +31,6 @@ static Evas_Smart_Class _parent_sc = EVAS_SMART_CLASS_INIT_NULL;
|
|||
|
||||
static Eina_List *terms = NULL;
|
||||
|
||||
static void _remove_links(Termio *sd);
|
||||
static void _smart_apply(Evas_Object *obj);
|
||||
static void _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force);
|
||||
static void _smart_calculate(Evas_Object *obj);
|
||||
|
@ -137,7 +136,7 @@ termio_scroll_set(Evas_Object *obj, int scroll)
|
|||
Termio *sd = evas_object_smart_data_get(obj);
|
||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||
sd->scroll = scroll;
|
||||
_remove_links(sd);
|
||||
termio_remove_links(sd);
|
||||
_smart_apply(obj);
|
||||
}
|
||||
|
||||
|
@ -147,7 +146,7 @@ termio_scroll_top_backlog(Evas_Object *obj)
|
|||
Termio *sd = evas_object_smart_data_get(obj);
|
||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||
sd->scroll = INT32_MAX;
|
||||
_remove_links(sd);
|
||||
termio_remove_links(sd);
|
||||
_smart_apply(obj);
|
||||
}
|
||||
|
||||
|
@ -1428,8 +1427,8 @@ _update_link(Termio *sd, Eina_Bool same_geom)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_remove_links(Termio *sd)
|
||||
void
|
||||
termio_remove_links(Termio *sd)
|
||||
{
|
||||
Eina_Bool same_geom = EINA_FALSE;
|
||||
|
||||
|
@ -1494,7 +1493,7 @@ _hyperlink_mouseover(Termio *sd,
|
|||
if (sd->link.suspend)
|
||||
return;
|
||||
|
||||
_remove_links(sd);
|
||||
termio_remove_links(sd);
|
||||
sd->link.id = link_id;
|
||||
|
||||
hl = &sd->pty->hl.links[link_id];
|
||||
|
@ -1510,6 +1509,7 @@ _hyperlink_mouseover(Termio *sd,
|
|||
ssize_t w = 0;
|
||||
Termcell *cells;
|
||||
int start_x = -1;
|
||||
Eina_Bool add_tooltip = EINA_FALSE;
|
||||
|
||||
o = NULL;
|
||||
|
||||
|
@ -1540,10 +1540,16 @@ _hyperlink_mouseover(Termio *sd,
|
|||
evas_object_resize(o,
|
||||
(x - start_x) * sd->font.chw,
|
||||
sd->font.chh);
|
||||
_hyperlink_end(sd, hl, o,
|
||||
(y == sd->mouse.cy) &&
|
||||
add_tooltip = ((y == sd->mouse.cy) &&
|
||||
((start_x <= sd->mouse.cx) &&
|
||||
(sd->mouse.cx <= x)));
|
||||
_hyperlink_end(sd, hl, o, add_tooltip);
|
||||
if (add_tooltip)
|
||||
{
|
||||
sd->link.y1 = sd->link.y2 = y;
|
||||
sd->link.x1 = start_x;
|
||||
sd->link.x2 = x;
|
||||
}
|
||||
o = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1553,10 +1559,16 @@ _hyperlink_mouseover(Termio *sd,
|
|||
evas_object_resize(o,
|
||||
(x - start_x + 1) * sd->font.chw,
|
||||
sd->font.chh);
|
||||
_hyperlink_end(sd, hl, o,
|
||||
(y == sd->mouse.cy) &&
|
||||
add_tooltip = ((y == sd->mouse.cy) &&
|
||||
((start_x <= sd->mouse.cx) &&
|
||||
(sd->mouse.cx <= x)));
|
||||
_hyperlink_end(sd, hl, o, add_tooltip);
|
||||
if (add_tooltip)
|
||||
{
|
||||
sd->link.y1 = sd->link.y2 = y;
|
||||
sd->link.x1 = start_x;
|
||||
sd->link.x2 = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
termpty_backlog_unlock();
|
||||
|
@ -2307,7 +2319,7 @@ termio_focus_out(Evas_Object *termio)
|
|||
if (!sd->win) return;
|
||||
sd->pty->selection.last_click = 0;
|
||||
if (!sd->ctxpopup)
|
||||
_remove_links(sd);
|
||||
termio_remove_links(sd);
|
||||
term_unfocus(sd->term);
|
||||
}
|
||||
|
||||
|
@ -2326,13 +2338,13 @@ _smart_mouseover_apply(Termio *sd)
|
|||
if ((sd->mouse.cx < 0) || (sd->mouse.cy < 0) ||
|
||||
(sd->link.suspend) || (!term_is_focused(sd->term)))
|
||||
{
|
||||
_remove_links(sd);
|
||||
termio_remove_links(sd);
|
||||
return;
|
||||
}
|
||||
cell = termpty_cell_get(sd->pty, sd->mouse.cy - sd->scroll, sd->mouse.cx);
|
||||
if (!cell)
|
||||
{
|
||||
_remove_links(sd);
|
||||
termio_remove_links(sd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2347,7 +2359,7 @@ _smart_mouseover_apply(Termio *sd)
|
|||
&x1, &y1, &x2, &y2);
|
||||
if (!s)
|
||||
{
|
||||
_remove_links(sd);
|
||||
termio_remove_links(sd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2684,7 +2696,7 @@ _smart_cb_mouse_out(void *data,
|
|||
sd->mouse.cx = cx;
|
||||
sd->mouse.cy = cy;
|
||||
}
|
||||
_remove_links(sd);
|
||||
termio_remove_links(sd);
|
||||
|
||||
if (sd->mouseover_delay) ecore_timer_del(sd->mouseover_delay);
|
||||
sd->mouseover_delay = NULL;
|
||||
|
@ -3226,7 +3238,8 @@ _smart_del(Evas_Object *obj)
|
|||
_win_obj_del, obj);
|
||||
EINA_LIST_FREE(sd->link.objs, o)
|
||||
{
|
||||
if (o == sd->link.down.dndobj) sd->link.down.dndobj = NULL;
|
||||
if (o == sd->link.down.dndobj)
|
||||
sd->link.down.dndobj = NULL;
|
||||
evas_object_del(o);
|
||||
}
|
||||
if (sd->link.down.dndobj) evas_object_del(sd->link.down.dndobj);
|
||||
|
|
|
@ -33,6 +33,7 @@ Eina_Bool termio_take_selection(Evas_Object *obj, Elm_Sel_Type);
|
|||
void termio_paste_selection(Evas_Object *obj, Elm_Sel_Type);
|
||||
const char *termio_link_get(const Evas_Object *obj,
|
||||
Eina_Bool *from_escape_code);
|
||||
void termio_remove_links(Termio *sd);
|
||||
void termio_mouseover_suspend_pushpop(Evas_Object *obj, int dir);
|
||||
void termio_event_feed_mouse_in(Evas_Object *obj);
|
||||
void termio_size_get(const Evas_Object *obj, int *w, int *h);
|
||||
|
|
|
@ -2439,6 +2439,7 @@ termio_internal_render(Termio *sd,
|
|||
Evas_Textgrid_Cell *tc;
|
||||
int cur_sel_start_x = -1, cur_sel_end_x = -1;
|
||||
int rel_y = y - sd->scroll;
|
||||
int l1 = -1, l2 = -1;
|
||||
|
||||
w = 0;
|
||||
cells = termpty_cellrow_get(sd->pty, rel_y, &w);
|
||||
|
@ -2481,6 +2482,35 @@ termio_internal_render(Termio *sd,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (EINA_UNLIKELY(sd->link.objs != NULL))
|
||||
{
|
||||
if (sd->link.y1 == sd->link.y2)
|
||||
{
|
||||
if (y == sd->link.y1)
|
||||
{
|
||||
l1 = sd->link.x1;
|
||||
l2 = sd->link.x2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (y == sd->link.y1)
|
||||
{
|
||||
l1 = sd->link.x1;
|
||||
l2 = w;
|
||||
}
|
||||
else if (y == sd->link.y2)
|
||||
{
|
||||
l1 = 0;
|
||||
l2 = sd->link.x2;
|
||||
}
|
||||
else if (y > sd->link.y1 && y < sd->link.y2)
|
||||
{
|
||||
l1 = sd->link.x1;
|
||||
l2 = sd->link.x2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ch1 = -1;
|
||||
/* Look at every cell in that line */
|
||||
|
@ -2515,6 +2545,11 @@ termio_internal_render(Termio *sd,
|
|||
termio_sel_set(sd, EINA_FALSE);
|
||||
u = cp = NULL;
|
||||
}
|
||||
if (EINA_UNLIKELY(l1 >= 0 && x >= l1 && x <= l2))
|
||||
{
|
||||
termio_remove_links(sd);
|
||||
l1 = l2 = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2554,6 +2589,11 @@ termio_internal_render(Termio *sd,
|
|||
termio_sel_set(sd, EINA_FALSE);
|
||||
u = cp = NULL;
|
||||
}
|
||||
if (EINA_UNLIKELY(l1 >= 0 && x >= l1 && x <= l2))
|
||||
{
|
||||
termio_remove_links(sd);
|
||||
l1 = l2 = -1;
|
||||
}
|
||||
}
|
||||
else if (cells[x].att.invisible)
|
||||
{
|
||||
|
@ -2581,6 +2621,11 @@ termio_internal_render(Termio *sd,
|
|||
termio_sel_set(sd, EINA_FALSE);
|
||||
u = cp = NULL;
|
||||
}
|
||||
if (EINA_UNLIKELY(l1 >= 0 && x >= l1 && x <= l2))
|
||||
{
|
||||
termio_remove_links(sd);
|
||||
l1 = l2 = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2658,6 +2703,12 @@ termio_internal_render(Termio *sd,
|
|||
tc[x].double_width = cells[x].att.dblwidth;
|
||||
tc[x].fg = fg;
|
||||
tc[x].bg = bg;
|
||||
if (tc[x].codepoint != codepoint &&
|
||||
EINA_UNLIKELY(l1 >= 0 && x >= l1 && x <= l2))
|
||||
{
|
||||
termio_remove_links(sd);
|
||||
l1 = l2 = -1;
|
||||
}
|
||||
tc[x].codepoint = codepoint;
|
||||
if ((tc[x].double_width) && (tc[x].codepoint == 0) &&
|
||||
(ch2 == x - 1))
|
||||
|
|
|
@ -217,6 +217,19 @@ termio_take_selection(Evas_Object *obj,
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
termio_remove_links(Termio *sd)
|
||||
{
|
||||
sd->link.string = NULL;
|
||||
sd->link.x1 = -1;
|
||||
sd->link.y1 = -1;
|
||||
sd->link.x2 = -1;
|
||||
sd->link.y2 = -1;
|
||||
sd->link.suspend = EINA_FALSE;
|
||||
sd->link.id = 0;
|
||||
sd->link.objs = 0;
|
||||
}
|
||||
|
||||
#ifndef TYTEST
|
||||
void
|
||||
termio_set_cursor_shape(Evas_Object *obj EINA_UNUSED,
|
||||
|
|
Loading…
Reference in New Issue