termio/termptyops: remove termio_content_change()

It shall no longer be needed.
This commit is contained in:
Boris Faure 2019-01-27 19:49:00 +01:00
parent 3d82c70793
commit 891168a9a7
2 changed files with 8 additions and 99 deletions

View File

@ -214,7 +214,8 @@ _termio_scroll_selection(Termio *sd, Termpty *ty,
}
void
termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y)
termio_scroll(Evas_Object *obj, int direction,
int start_y, int end_y)
{
Termio *sd = evas_object_smart_data_get(obj);
Termpty *ty;
@ -227,101 +228,17 @@ termio_scroll(Evas_Object *obj, int direction, int start_y, int end_y)
(sd->scroll > 0))
{
Evas_Object *mv = term_miniview_get(sd->term);
if (mv) miniview_position_offset(mv, direction, EINA_FALSE);
if (mv)
{
miniview_position_offset(mv, direction, EINA_FALSE);
}
// adjust scroll position for added scrollback
sd->scroll -= direction;
}
_termio_scroll_selection(sd, ty, direction, start_y, end_y);
if (sd->link.string)
{
if (sd->link.y1 <= end_y && sd->link.y2 >= start_y)
_remove_links(sd);
}
}
void
termio_content_change(Evas_Object *obj, Evas_Coord x, Evas_Coord y,
int n)
{
Termpty *ty;
int start_x, start_y, end_x, end_y;
Termio *sd = evas_object_smart_data_get(obj);
EINA_SAFETY_ON_NULL_RETURN(sd);
ty = sd->pty;
if (sd->link.string)
{
int _y = y + (x + n) / ty->w;
start_x = sd->link.x1;
start_y = sd->link.y1;
end_x = sd->link.x2;
end_y = sd->link.y2;
y = MAX(y, start_y);
for (; y <= MIN(_y, end_y); y++)
{
int d = MIN(n, ty->w - x);
if (!((x > end_x) || (x + d < start_x)))
{
_remove_links(sd);
break;
}
n -= d;
x = 0;
}
}
if (!ty->selection.is_active) return;
start_x = sd->pty->selection.start.x;
start_y = sd->pty->selection.start.y;
end_x = sd->pty->selection.end.x;
end_y = sd->pty->selection.end.y;
if (!sd->pty->selection.is_top_to_bottom)
{
INT_SWAP(start_y, end_y);
INT_SWAP(start_x, end_x);
}
if (ty->selection.is_box)
{
int _y = y + (x + n) / ty->w;
y = MAX(y, start_y);
for (; y <= MIN(_y, end_y); y++)
{
int d = MIN(n, ty->w - x);
if (!((x > end_x) || (x + d < start_x)))
{
_sel_set(sd, EINA_FALSE);
break;
}
n -= d;
x = 0;
}
}
else
{
int sel_len;
Termcell *cells_changed, *cells_selection;
sel_len = end_x - start_x + ty->w * (end_y - start_y);
cells_changed = &(TERMPTY_SCREEN(ty, x, y));
cells_selection = &(TERMPTY_SCREEN(ty, start_x, start_y));
if (!((cells_changed > (cells_selection + sel_len)) ||
(cells_selection > (cells_changed + n))))
{
_sel_set(sd, EINA_FALSE);
}
}
}
static void
_win_obj_del(void *data,
Evas *_e EINA_UNUSED,

View File

@ -178,10 +178,6 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
int i, j;
int origin = ty->termstate.left_margin;
/* TODO: have content_change_box*/
termio_content_change(ty->obj, ty->cursor_state.cx, ty->cursor_state.cy, len);
cells = &(TERMPTY_SCREEN(ty, 0, ty->cursor_state.cy));
for (i = 0; i < len; i++)
{
@ -299,8 +295,8 @@ termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit)
return;
}
cells = &(TERMPTY_SCREEN(ty, x, y));
if (n > limit) n = limit;
termio_content_change(ty->obj, x, y, n);
if (n > limit)
n = limit;
termpty_cells_clear(ty, cells, n);
}
@ -352,8 +348,6 @@ termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
{
int l = ty->h - (ty->cursor_state.cy + 1);
termio_content_change(ty->obj, 0, ty->cursor_state.cy, l * ty->w);
while (l)
{
cells = &(TERMPTY_SCREEN(ty, 0, (ty->cursor_state.cy + l)));
@ -368,8 +362,6 @@ termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
// First clear from circular > height, then from 0 to circular
int y = ty->cursor_state.cy + ty->circular_offset;
termio_content_change(ty->obj, 0, 0, ty->cursor_state.cy * ty->w);
cells = &(TERMPTY_SCREEN(ty, 0, 0));
if (y < ty->h)