grid: scroll reverse: hopefully done correct now

This commit is contained in:
Daniel Eklöf 2019-06-24 20:49:37 +02:00
parent 0e078f44b6
commit 0f76f4190a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

6
grid.c
View file

@ -316,7 +316,6 @@ grid_scroll_reverse_partial(struct grid *grid, int offset, int rows)
{
const int grid_rows = grid->scrolling_region.end - grid->scrolling_region.start;
const int top_margin = grid->scrolling_region.start;
const int bottom_margin = grid->rows - grid->scrolling_region.end;
if (rows >= grid_rows - offset) {
assert(false && "todo");
@ -325,9 +324,10 @@ grid_scroll_reverse_partial(struct grid *grid, int offset, int rows)
int cell_dst = (top_margin + offset + rows) * grid->cols;
int cell_src = (top_margin + offset) * grid->cols;
int cell_count = (grid_rows - bottom_margin - top_margin - offset - rows) * grid->cols;
int cell_count = (grid_rows - offset - rows) * grid->cols;
LOG_DBG("moving %d cells from %d", cell_count, cell_src);
LOG_DBG("moving %d lines from row %d to row %d", cell_count / grid->cols,
cell_src / grid->cols, (top_margin + offset) / grid->cols);
const size_t bytes = cell_count * sizeof(grid->cells[0]);
memmove(