forked from enlightenment/terminology
add termpty_screen_swap() to simplify code
This commit is contained in:
parent
7447178071
commit
df2b87308b
|
@ -1484,20 +1484,38 @@ termpty_cell_copy(Termpty *ty, Termcell *src, Termcell *dst, int n)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
termpty_cell_swap(Termpty *ty EINA_UNUSED, Termcell *src, Termcell *dst, int n)
|
||||
static void
|
||||
_swap_line(Termpty *ty, Termcell *cells, Termcell *cells2)
|
||||
{
|
||||
int i;
|
||||
Termcell t;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
int x;
|
||||
Termcell c;
|
||||
|
||||
for (x = 0; x < ty->w; x++)
|
||||
{
|
||||
t = dst[i];
|
||||
dst[i] = src[i];
|
||||
src[i] = t;
|
||||
c = cells[x];
|
||||
cells[x] = cells2[x];
|
||||
cells2[x] = c;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
termpty_screen_swap(Termpty *ty)
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y = 0; y < ty->h; y++)
|
||||
{
|
||||
_swap_line(ty,
|
||||
&(TERMPTY_SCREEN(ty, 0, y)),
|
||||
&ty->screen2[y * ty->w]);
|
||||
}
|
||||
ty->circular_offset = 0;
|
||||
ty->altbuf = !ty->altbuf;
|
||||
|
||||
if (ty->cb.cancel_sel.func)
|
||||
ty->cb.cancel_sel.func(ty->cb.cancel_sel.data);
|
||||
}
|
||||
|
||||
void
|
||||
termpty_cell_fill(Termpty *ty, Termcell *src, Termcell *dst, int n)
|
||||
{
|
||||
|
|
|
@ -225,9 +225,9 @@ void termpty_block_chid_update(Termpty *ty, Termblock *blk);
|
|||
Termblock *termpty_block_chid_get(Termpty *ty, const char *chid);
|
||||
|
||||
void termpty_cell_copy(Termpty *ty, Termcell *src, Termcell *dst, int n);
|
||||
void termpty_cell_swap(Termpty *ty, Termcell *src, Termcell *dst, int n);
|
||||
void termpty_cell_fill(Termpty *ty, Termcell *src, Termcell *dst, int n);
|
||||
void termpty_cell_codepoint_att_fill(Termpty *ty, int codepoint, Termatt att, Termcell *dst, int n);
|
||||
void termpty_screen_swap(Termpty *ty);
|
||||
|
||||
ssize_t termpty_line_length(const Termcell *cells, ssize_t nb_cells);
|
||||
|
||||
|
|
|
@ -626,8 +626,6 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
|
|||
arg = _csi_arg_get(&b);
|
||||
if (b)
|
||||
{
|
||||
int size;
|
||||
|
||||
// complete-ish list here:
|
||||
// http://ttssh2.sourceforge.jp/manual/en/about/ctrlseq.html
|
||||
switch (arg)
|
||||
|
@ -830,7 +828,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
|
|||
{
|
||||
// if we are looking at alt buf now,
|
||||
// clear main buf before we swap it back
|
||||
// into the sreen2 save (so save is
|
||||
// into the screen2 save (so save is
|
||||
// clear)
|
||||
_termpty_clear_all(ty);
|
||||
// _termpty_cursor_copy(&(ty->swap), &(ty->state));
|
||||
|
@ -841,16 +839,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
|
|||
// _termpty_cursor_copy(&(ty->state), &(ty->swap));
|
||||
ty->swap = ty->state;
|
||||
}
|
||||
size = ty->w * ty->h;
|
||||
// swap screen content now
|
||||
for (i = 0; i < size; i++)
|
||||
termpty_cell_swap(ty,
|
||||
&(ty->screen[(i + ty->circular_offset * ty->w) % size]),
|
||||
&(ty->screen2[i]),
|
||||
1);
|
||||
ty->altbuf = !ty->altbuf;
|
||||
if (ty->cb.cancel_sel.func)
|
||||
ty->cb.cancel_sel.func(ty->cb.cancel_sel.data);
|
||||
termpty_screen_swap(ty);
|
||||
break;
|
||||
case 1048:
|
||||
if (mode)
|
||||
|
|
Loading…
Reference in New Issue