express: Fix inconsistencies while debugging broken scrolling
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
4aabf71564
commit
63a011f9e2
|
@ -1275,6 +1275,7 @@ _smart_apply(Evas_Object *obj)
|
|||
|
||||
inv = sd->state.reverse;
|
||||
_grid_save_freeze();
|
||||
|
||||
for (y = 0; y < sd->grid.h; y++)
|
||||
{
|
||||
Grid_Cell *cells;
|
||||
|
@ -1282,6 +1283,12 @@ _smart_apply(Evas_Object *obj)
|
|||
|
||||
w = 0;
|
||||
cells = _cellrow_get(sd, y - sd->scroll, &w);
|
||||
/* if (!cells) */
|
||||
/* { */
|
||||
/* fprintf(stderr, "ERR: COULD NOT GET CELLS !!\n"); */
|
||||
/* fprintf(stderr, "\tY: %d\tScroll: %d\tW: %d\n", y, sd->scroll, w); */
|
||||
/* } */
|
||||
|
||||
tc = evas_object_textgrid_cellrow_get(sd->grid.obj, y);
|
||||
if (!tc) continue;
|
||||
ch1 = -1;
|
||||
|
@ -1387,6 +1394,9 @@ _smart_apply(Evas_Object *obj)
|
|||
// cells[x].att.blink2
|
||||
}
|
||||
}
|
||||
/* fprintf(stderr, "Textgrid Cell %d\n", x); */
|
||||
/* fprintf(stderr, "\tCodepoint: %d\tFG: %d\tBG: %d\n", */
|
||||
/* tc[x].codepoint, tc[x].fg, tc[x].bg); */
|
||||
}
|
||||
|
||||
evas_object_textgrid_cellrow_set(sd->grid.obj, y, tc);
|
||||
|
@ -1494,7 +1504,7 @@ _cellrow_get(Grid *sd, int y, int *wret)
|
|||
|
||||
if (y >= 0)
|
||||
{
|
||||
if (y > sd->h) return NULL;
|
||||
if (y >= sd->h) return NULL;
|
||||
*wret = sd->w;
|
||||
return &(GRID_CELLS(sd, 0, y));
|
||||
}
|
||||
|
@ -1565,10 +1575,10 @@ _cells_swap(Grid *sd)
|
|||
sd->cells =sd->cells2;
|
||||
sd->cells2 = tmp;
|
||||
|
||||
if (sd->altbuf)
|
||||
sd->state = sd->swap;
|
||||
else
|
||||
sd->swap = sd->state;
|
||||
/* if (sd->altbuf) */
|
||||
/* sd->state = sd->swap; */
|
||||
/* else */
|
||||
/* sd->swap = sd->state; */
|
||||
|
||||
tmp_circular_offset = sd->circular_offset;
|
||||
sd->circular_offset = sd->circular_offset2;
|
||||
|
@ -1578,13 +1588,26 @@ _cells_swap(Grid *sd)
|
|||
}
|
||||
|
||||
static void
|
||||
_limit_coord(Grid *sd, Grid_State *state)
|
||||
_limit_coord(Grid *sd)
|
||||
{
|
||||
state->wrapnext = 0;
|
||||
if (state->cx >= sd->w) state->cx = sd->w - 1;
|
||||
if (state->cy >= sd->h) state->cy = sd->h - 1;
|
||||
if (state->had_cr_x >= sd->w) state->had_cr_x = sd->w - 1;
|
||||
if (state->had_cr_y >= sd->h) state->had_cr_y = sd->h - 1;
|
||||
if (sd->state.had_cr_x >= sd->w) sd->state.had_cr_x = (sd->w - 1);
|
||||
else if (sd->state.had_cr_x < 0) sd->state.had_cr_x = 0;
|
||||
|
||||
if (sd->state.had_cr_y >= sd->h) sd->state.had_cr_y = (sd->h - 1);
|
||||
else if (sd->state.had_cr_y < 0) sd->state.had_cr_y = 0;
|
||||
|
||||
/* state->wrapnext = 0; */
|
||||
if (sd->state.cx >= sd->w) sd->state.cx = sd->w - 1;
|
||||
else if (sd->state.cx < 0) sd->state.cx = 0;
|
||||
|
||||
if (sd->state.cy >= sd->h) sd->state.cy = sd->h - 1;
|
||||
else if (sd->state.cy < 0) sd->state.cy = 0;
|
||||
|
||||
if (sd->save.cx >= sd->w) sd->save.cx = (sd->w - 1);
|
||||
else if (sd->save.cx < 0) sd->save.cx = 0;
|
||||
|
||||
if (sd->save.cy >= sd->h) sd->save.cy = (sd->h - 1);
|
||||
else if (sd->save.cy < 0) sd->save.cy = 0;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
|
@ -1831,9 +1854,9 @@ _text_scroll(Grid *sd, Eina_Bool clear)
|
|||
_text_save_top(sd, &(GRID_CELLS(sd, 0, 0)), sd->w);
|
||||
}
|
||||
|
||||
_scroll(sd, 1, start_y, end_y);
|
||||
_scroll(sd, -1, start_y, end_y);
|
||||
|
||||
if ((start_y == 0) && (end_y = (sd->h - 1)))
|
||||
if ((start_y == 0) && (end_y == (sd->h - 1)))
|
||||
{
|
||||
cells = &(sd->cells[sd->circular_offset * sd->w]);
|
||||
if (clear)
|
||||
|
@ -1868,6 +1891,10 @@ _text_scroll_test(Grid *sd, Eina_Bool clear)
|
|||
{
|
||||
_text_scroll(sd, clear);
|
||||
sd->state.cy = (e - 1);
|
||||
if (sd->state.cy >= sd->h)
|
||||
sd->state.cy = (sd->h - 1);
|
||||
else if (sd->state.cy < 0)
|
||||
sd->state.cy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1896,7 +1923,7 @@ _cursor_handle(Grid *sd, const Eina_Unicode *cc)
|
|||
sd->state.wrapnext = 0;
|
||||
}
|
||||
sd->state.cx = 0;
|
||||
sd->state.had_cr = 1;
|
||||
// sd->state.had_cr = 1;
|
||||
break;
|
||||
case 0x09: // HT '\t' (horizontal tab)
|
||||
sd->state.had_cr = 0;
|
||||
|
@ -1910,6 +1937,8 @@ _cursor_handle(Grid *sd, const Eina_Unicode *cc)
|
|||
|
||||
if (sd->state.cx >= sd->w)
|
||||
sd->state.cx = (sd->w - 1);
|
||||
else if (sd->state.cx < 0)
|
||||
sd->state.cx = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2034,8 +2063,14 @@ _text_append(Grid *sd, const Eina_Unicode *codepoints, int len, Row_Color *color
|
|||
#endif
|
||||
if (EINA_UNLIKELY(sd->state.cx >= (sd->w - offset)))
|
||||
sd->state.wrapnext = 1;
|
||||
else
|
||||
sd->state.cx += offset;
|
||||
else
|
||||
{
|
||||
sd->state.cx += offset;
|
||||
if (sd->state.cx >= sd->w)
|
||||
sd->state.cx = (sd->w - 1);
|
||||
else if (sd->state.cx < 0)
|
||||
sd->state.cx = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2050,8 +2085,17 @@ _text_append(Grid *sd, const Eina_Unicode *codepoints, int len, Row_Color *color
|
|||
if (sd->state.cx > (sd->w - offset))
|
||||
{
|
||||
sd->state.cx = sd->w - offset;
|
||||
if (sd->state.cx >= sd->w)
|
||||
sd->state.cx = (sd->w - 1);
|
||||
else if (sd->state.cx < 0)
|
||||
sd->state.cx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sd->state.cx >= sd->w)
|
||||
sd->state.cx = (sd->w - 1);
|
||||
else if (sd->state.cx < 0)
|
||||
sd->state.cx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2062,7 +2106,7 @@ _seq_handle(Grid *sd, Eina_Unicode *c, Eina_Unicode *ce, Row_Color *color)
|
|||
Eina_Unicode *cc;
|
||||
int len = 0;
|
||||
|
||||
if (c[0] < 0x20 &&
|
||||
if ((c[0] < 0x20) &&
|
||||
c[0] != 2 && c[0] != 3 && c[0] != 15 && c[0] != 18 && c[0] != 31)
|
||||
{
|
||||
switch (c[0])
|
||||
|
@ -2081,6 +2125,7 @@ _seq_handle(Grid *sd, Eina_Unicode *c, Eina_Unicode *ce, Row_Color *color)
|
|||
sd->state.had_cr = 0;
|
||||
|
||||
cc = c;
|
||||
|
||||
while ((cc < ce) && (*cc != 0x7f) && (*cc >= 0x20
|
||||
|| *cc == 2 || *cc == 3 || *cc == 15 || *cc == 18 || *cc == 31))
|
||||
{
|
||||
|
@ -2302,6 +2347,7 @@ _grid_add(Evas *evas)
|
|||
|
||||
sd->w = 80;
|
||||
sd->h = 24;
|
||||
sd->backmax = 2000;
|
||||
|
||||
_state_reset(sd);
|
||||
sd->save = sd->state;
|
||||
|
@ -2454,14 +2500,13 @@ _grid_resize(Evas_Object *obj, int nw, int nh)
|
|||
sd->backscroll_num = MAX(-new_y_start, 0);
|
||||
sd->state.had_cr = 0;
|
||||
|
||||
sd->state.cy = nh;
|
||||
/* sd->state.cy = (new_cy + nh - sd->circular_offset) % nh; */
|
||||
sd->state.cy = (new_cy + nh - sd->circular_offset) % nh;
|
||||
|
||||
if (altbuf) _cells_swap(sd);
|
||||
|
||||
_limit_coord(sd, &(sd->state));
|
||||
_limit_coord(sd, &(sd->swap));
|
||||
_limit_coord(sd, &(sd->save));
|
||||
sd->state.wrapnext = 0;
|
||||
|
||||
_limit_coord(sd);
|
||||
|
||||
_grid_save_thaw();
|
||||
|
||||
|
|
Loading…
Reference in New Issue