diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-04-16 16:51:14 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-04-16 16:51:14 +0000 |
| commit | 89559d5466502176995720a33316714012a638d1 (patch) | |
| tree | 2aefe77cf082d80f892753360cd598b430615204 /render.c | |
| parent | misc: replace all explicit zero-initializers with empty initializers (diff) | |
grid: move 'cursor' state from terminal to grid
This way, the 'normal' and 'alt' grids have their own cursor state,
and we don't need to switch between them.
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -1373,7 +1373,7 @@ grid_render(struct terminal *term) */ bool cursor_is_visible = false; int view_end = (term->grid->view + term->rows - 1) & (term->grid->num_rows - 1); - int cursor_row = (term->grid->offset + term->cursor.point.row) & (term->grid->num_rows - 1); + int cursor_row = (term->grid->offset + term->grid->cursor.point.row) & (term->grid->num_rows - 1); if (view_end >= term->grid->view) { /* Not wrapped */ if (cursor_row >= term->grid->view && cursor_row <= view_end) @@ -1401,21 +1401,21 @@ grid_render(struct terminal *term) int view_aligned_row = (cursor_row - term->grid->view + term->grid->num_rows) & (term->grid->num_rows - 1); - term->render.last_cursor.actual = term->cursor.point; + term->render.last_cursor.actual = term->grid->cursor.point; term->render.last_cursor.in_view = (struct coord) { - term->cursor.point.col, view_aligned_row}; + term->grid->cursor.point.col, view_aligned_row}; struct row *row = grid_row_in_view(term->grid, view_aligned_row); - struct cell *cell = &row->cells[term->cursor.point.col]; + struct cell *cell = &row->cells[term->grid->cursor.point.col]; cell->attrs.clean = 0; term->render.last_cursor.cell = cell; int cols_updated = render_cell( - term, buf->pix, cell, term->cursor.point.col, view_aligned_row, true); + term, buf->pix, cell, term->grid->cursor.point.col, view_aligned_row, true); wl_surface_damage_buffer( term->window->surface, - term->margins.left + term->cursor.point.col * term->cell_width, + term->margins.left + term->grid->cursor.point.col * term->cell_width, term->margins.top + view_aligned_row * term->cell_height, cols_updated * term->cell_width, term->cell_height); } @@ -1804,7 +1804,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force) term_cursor_to( term, cursor_row, - min(term->cursor.point.col, term->cols - 1)); + min(term->grid->cursor.point.col, term->cols - 1)); /* If in alt screen, update the saved 'normal' cursor too */ if (term->grid == &term->alt) { @@ -1813,10 +1813,10 @@ maybe_resize(struct terminal *term, int width, int height, bool force) while (cursor_row < 0) cursor_row += term->grid->num_rows; - term->alt_saved_cursor.lcf = false; - term->alt_saved_cursor.point.row = cursor_row; - term->alt_saved_cursor.point.col = min( - term->alt_saved_cursor.point.col, term->cols - 1); + term->normal.cursor.lcf = false; + term->normal.cursor.point.row = cursor_row; + term->normal.cursor.point.col = min( + term->normal.cursor.point.col, term->cols - 1); } term->render.last_cursor.cell = NULL; |
