aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-06-24 18:49:37 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-06-24 18:49:37 +0000
commit0f76f4190a951f4db224034c5ae8884893c3ba21 (patch)
treee6c8da7fc0498cada5b32230a59cb9d79eef69fc
parentgrid: scroll: fix start/end for erase region (diff)
grid: scroll reverse: hopefully done correct now
-rw-r--r--grid.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/grid.c b/grid.c
index 01622bd2..d4b8cbe5 100644
--- a/grid.c
+++ b/grid.c
@@ -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(