s/scroll_y1/top_margin/, s/scroll_y2/bottom_margin/

This commit is contained in:
Boris Faure 2017-05-29 23:26:32 +02:00
parent fd05f3cab5
commit 6ce96da8c4
3 changed files with 31 additions and 31 deletions

View File

@ -134,7 +134,7 @@ struct _Termpty
unsigned char charset; unsigned char charset;
unsigned char charsetch; unsigned char charsetch;
unsigned char chset[4]; unsigned char chset[4];
int scroll_y1, scroll_y2; int top_margin, bottom_margin;
int had_cr_x, had_cr_y; int had_cr_x, had_cr_y;
int margin_top; // soon, more to come... int margin_top; // soon, more to come...
unsigned int multibyte : 1; unsigned int multibyte : 1;

View File

@ -913,18 +913,18 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
{ {
int sy1, sy2; int sy1, sy2;
sy1 = ty->termstate.scroll_y1; sy1 = ty->termstate.top_margin;
sy2 = ty->termstate.scroll_y2; sy2 = ty->termstate.bottom_margin;
if (ty->termstate.scroll_y2 == 0) if (ty->termstate.bottom_margin == 0)
{ {
ty->termstate.scroll_y1 = ty->cursor_state.cy; ty->termstate.top_margin = ty->cursor_state.cy;
ty->termstate.scroll_y2 = ty->h; ty->termstate.bottom_margin = ty->h;
} }
else else
{ {
ty->termstate.scroll_y1 = ty->cursor_state.cy; ty->termstate.top_margin = ty->cursor_state.cy;
if (ty->termstate.scroll_y2 <= ty->termstate.scroll_y1) if (ty->termstate.bottom_margin <= ty->termstate.top_margin)
ty->termstate.scroll_y2 = ty->termstate.scroll_y1 + 1; ty->termstate.bottom_margin = ty->termstate.top_margin + 1;
} }
for (i = 0; i < arg; i++) for (i = 0; i < arg; i++)
{ {
@ -933,8 +933,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
else else
termpty_text_scroll_rev(ty, EINA_TRUE); termpty_text_scroll_rev(ty, EINA_TRUE);
} }
ty->termstate.scroll_y1 = sy1; ty->termstate.top_margin = sy1;
ty->termstate.scroll_y2 = sy2; ty->termstate.bottom_margin = sy2;
} }
break; break;
case 'P': // erase and scrollback N chars case 'P': // erase and scrollback N chars
@ -1051,8 +1051,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
if (!b) if (!b)
{ {
WRN("no region args reset region"); WRN("no region args reset region");
ty->termstate.scroll_y1 = 0; ty->termstate.top_margin = 0;
ty->termstate.scroll_y2 = 0; ty->termstate.bottom_margin = 0;
} }
else else
{ {
@ -1062,26 +1062,26 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
if (!b) if (!b)
{ {
WRN("failed to give 2 regions args reset region"); WRN("failed to give 2 regions args reset region");
ty->termstate.scroll_y1 = 0; ty->termstate.top_margin = 0;
ty->termstate.scroll_y2 = 0; ty->termstate.bottom_margin = 0;
} }
else else
{ {
if (arg > arg2) if (arg > arg2)
{ {
DBG("scroll region beginning > end [%i %i]", arg, arg2); DBG("scroll region beginning > end [%i %i]", arg, arg2);
ty->termstate.scroll_y1 = 0; ty->termstate.top_margin = 0;
ty->termstate.scroll_y2 = 0; ty->termstate.bottom_margin = 0;
} }
else else
{ {
DBG("2 regions args: %i %i", arg, arg2); DBG("2 regions args: %i %i", arg, arg2);
TERMPTY_RESTRICT_FIELD(arg, 1, ty->h); TERMPTY_RESTRICT_FIELD(arg, 1, ty->h);
TERMPTY_RESTRICT_FIELD(arg2, 1, ty->h+1); TERMPTY_RESTRICT_FIELD(arg2, 1, ty->h+1);
ty->termstate.scroll_y1 = arg - 1; ty->termstate.top_margin = arg - 1;
ty->termstate.scroll_y2 = arg2; ty->termstate.bottom_margin = arg2;
if ((arg == 1) && (arg2 == ty->h)) if ((arg == 1) && (arg2 == ty->h))
ty->termstate.scroll_y2 = 0; ty->termstate.bottom_margin = 0;
} }
} }
} }

View File

@ -38,10 +38,10 @@ termpty_text_scroll(Termpty *ty, Eina_Bool clear)
Termcell *cells = NULL, *cells2; Termcell *cells = NULL, *cells2;
int y, start_y = 0, end_y = ty->h - 1; int y, start_y = 0, end_y = ty->h - 1;
if (ty->termstate.scroll_y2 != 0) if (ty->termstate.bottom_margin != 0)
{ {
start_y = ty->termstate.scroll_y1; start_y = ty->termstate.top_margin;
end_y = ty->termstate.scroll_y2 - 1; end_y = ty->termstate.bottom_margin - 1;
} }
else else
if (!ty->altbuf) if (!ty->altbuf)
@ -81,10 +81,10 @@ termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
Termcell *cells, *cells2 = NULL; Termcell *cells, *cells2 = NULL;
int y, start_y = 0, end_y = ty->h - 1; int y, start_y = 0, end_y = ty->h - 1;
if (ty->termstate.scroll_y2 != 0) if (ty->termstate.bottom_margin != 0)
{ {
start_y = ty->termstate.scroll_y1; start_y = ty->termstate.top_margin;
end_y = ty->termstate.scroll_y2 - 1; end_y = ty->termstate.bottom_margin - 1;
} }
DBG("... scroll rev!!!!! [%i->%i]", start_y, end_y); DBG("... scroll rev!!!!! [%i->%i]", start_y, end_y);
termio_scroll(ty->obj, 1, start_y, end_y); termio_scroll(ty->obj, 1, start_y, end_y);
@ -119,7 +119,7 @@ termpty_text_scroll_test(Termpty *ty, Eina_Bool clear)
{ {
int e = ty->h; int e = ty->h;
if (ty->termstate.scroll_y2 != 0) e = ty->termstate.scroll_y2; if (ty->termstate.bottom_margin != 0) e = ty->termstate.bottom_margin;
if (ty->cursor_state.cy >= e) if (ty->cursor_state.cy >= e)
{ {
termpty_text_scroll(ty, clear); termpty_text_scroll(ty, clear);
@ -133,7 +133,7 @@ termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear)
{ {
int b = 0; int b = 0;
if (ty->termstate.scroll_y1 != 0) b = ty->termstate.scroll_y1; if (ty->termstate.top_margin != 0) b = ty->termstate.top_margin;
if (ty->cursor_state.cy < b) if (ty->cursor_state.cy < b)
{ {
termpty_text_scroll_rev(ty, clear); termpty_text_scroll_rev(ty, clear);
@ -350,7 +350,7 @@ termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
case TERMPTY_CLR_ALL: case TERMPTY_CLR_ALL:
ty->circular_offset = 0; ty->circular_offset = 0;
termpty_cells_clear(ty, ty->screen, ty->w * ty->h); termpty_cells_clear(ty, ty->screen, ty->w * ty->h);
ty->termstate.scroll_y2 = 0; ty->termstate.bottom_margin = 0;
if (ty->cb.cancel_sel.func) if (ty->cb.cancel_sel.func)
ty->cb.cancel_sel.func(ty->cb.cancel_sel.data); ty->cb.cancel_sel.func(ty->cb.cancel_sel.data);
break; break;
@ -397,8 +397,8 @@ termpty_reset_state(Termpty *ty)
ty->cursor_state.cx = 0; ty->cursor_state.cx = 0;
ty->cursor_state.cy = 0; ty->cursor_state.cy = 0;
ty->termstate.scroll_y1 = 0; ty->termstate.top_margin = 0;
ty->termstate.scroll_y2 = 0; ty->termstate.bottom_margin = 0;
ty->termstate.had_cr_x = 0; ty->termstate.had_cr_x = 0;
ty->termstate.had_cr_y = 0; ty->termstate.had_cr_y = 0;
termpty_reset_att(&(ty->termstate.att)); termpty_reset_att(&(ty->termstate.att));