From 0f76f4190a951f4db224034c5ae8884893c3ba21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 24 Jun 2019 20:49:37 +0200 Subject: [PATCH] grid: scroll reverse: hopefully done correct now --- grid.c | 6 +++--- 1 file 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(