From 6ce96da8c4561ee9a9b74d6beed152e65af544a5 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Mon, 29 May 2017 23:26:32 +0200 Subject: [PATCH] s/scroll_y1/top_margin/, s/scroll_y2/bottom_margin/ --- src/bin/termpty.h | 2 +- src/bin/termptyesc.c | 38 +++++++++++++++++++------------------- src/bin/termptyops.c | 22 +++++++++++----------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/bin/termpty.h b/src/bin/termpty.h index c6d93d37..5ca0193b 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -134,7 +134,7 @@ struct _Termpty unsigned char charset; unsigned char charsetch; unsigned char chset[4]; - int scroll_y1, scroll_y2; + int top_margin, bottom_margin; int had_cr_x, had_cr_y; int margin_top; // soon, more to come... unsigned int multibyte : 1; diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index b47f8bc7..602c2940 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -913,18 +913,18 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce) { int sy1, sy2; - sy1 = ty->termstate.scroll_y1; - sy2 = ty->termstate.scroll_y2; - if (ty->termstate.scroll_y2 == 0) + sy1 = ty->termstate.top_margin; + sy2 = ty->termstate.bottom_margin; + if (ty->termstate.bottom_margin == 0) { - ty->termstate.scroll_y1 = ty->cursor_state.cy; - ty->termstate.scroll_y2 = ty->h; + ty->termstate.top_margin = ty->cursor_state.cy; + ty->termstate.bottom_margin = ty->h; } else { - ty->termstate.scroll_y1 = ty->cursor_state.cy; - if (ty->termstate.scroll_y2 <= ty->termstate.scroll_y1) - ty->termstate.scroll_y2 = ty->termstate.scroll_y1 + 1; + ty->termstate.top_margin = ty->cursor_state.cy; + if (ty->termstate.bottom_margin <= ty->termstate.top_margin) + ty->termstate.bottom_margin = ty->termstate.top_margin + 1; } for (i = 0; i < arg; i++) { @@ -933,8 +933,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce) else termpty_text_scroll_rev(ty, EINA_TRUE); } - ty->termstate.scroll_y1 = sy1; - ty->termstate.scroll_y2 = sy2; + ty->termstate.top_margin = sy1; + ty->termstate.bottom_margin = sy2; } break; 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) { WRN("no region args reset region"); - ty->termstate.scroll_y1 = 0; - ty->termstate.scroll_y2 = 0; + ty->termstate.top_margin = 0; + ty->termstate.bottom_margin = 0; } else { @@ -1062,26 +1062,26 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce) if (!b) { WRN("failed to give 2 regions args reset region"); - ty->termstate.scroll_y1 = 0; - ty->termstate.scroll_y2 = 0; + ty->termstate.top_margin = 0; + ty->termstate.bottom_margin = 0; } else { if (arg > arg2) { DBG("scroll region beginning > end [%i %i]", arg, arg2); - ty->termstate.scroll_y1 = 0; - ty->termstate.scroll_y2 = 0; + ty->termstate.top_margin = 0; + ty->termstate.bottom_margin = 0; } else { DBG("2 regions args: %i %i", arg, arg2); TERMPTY_RESTRICT_FIELD(arg, 1, ty->h); TERMPTY_RESTRICT_FIELD(arg2, 1, ty->h+1); - ty->termstate.scroll_y1 = arg - 1; - ty->termstate.scroll_y2 = arg2; + ty->termstate.top_margin = arg - 1; + ty->termstate.bottom_margin = arg2; if ((arg == 1) && (arg2 == ty->h)) - ty->termstate.scroll_y2 = 0; + ty->termstate.bottom_margin = 0; } } } diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c index 698efbb8..4edc0c74 100644 --- a/src/bin/termptyops.c +++ b/src/bin/termptyops.c @@ -38,10 +38,10 @@ termpty_text_scroll(Termpty *ty, Eina_Bool clear) Termcell *cells = NULL, *cells2; 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; - end_y = ty->termstate.scroll_y2 - 1; + start_y = ty->termstate.top_margin; + end_y = ty->termstate.bottom_margin - 1; } else if (!ty->altbuf) @@ -81,10 +81,10 @@ termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear) Termcell *cells, *cells2 = NULL; 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; - end_y = ty->termstate.scroll_y2 - 1; + start_y = ty->termstate.top_margin; + end_y = ty->termstate.bottom_margin - 1; } DBG("... scroll rev!!!!! [%i->%i]", 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; - 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) { termpty_text_scroll(ty, clear); @@ -133,7 +133,7 @@ termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear) { 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) { termpty_text_scroll_rev(ty, clear); @@ -350,7 +350,7 @@ termpty_clear_screen(Termpty *ty, Termpty_Clear mode) case TERMPTY_CLR_ALL: ty->circular_offset = 0; 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) ty->cb.cancel_sel.func(ty->cb.cancel_sel.data); break; @@ -397,8 +397,8 @@ termpty_reset_state(Termpty *ty) ty->cursor_state.cx = 0; ty->cursor_state.cy = 0; - ty->termstate.scroll_y1 = 0; - ty->termstate.scroll_y2 = 0; + ty->termstate.top_margin = 0; + ty->termstate.bottom_margin = 0; ty->termstate.had_cr_x = 0; ty->termstate.had_cr_y = 0; termpty_reset_att(&(ty->termstate.att));