mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
grid: erase: memset() the entire range in one call
This commit is contained in:
parent
efc8cc4914
commit
96731814da
2 changed files with 10 additions and 10 deletions
8
grid.c
8
grid.c
|
|
@ -13,17 +13,19 @@
|
|||
void
|
||||
grid_erase(struct grid *grid, int start, int end)
|
||||
{
|
||||
assert(end >= start);
|
||||
memset(&grid->cells[start], 0, (end - start) * sizeof(grid->cells[0]));
|
||||
|
||||
for (int i = start; i < end; i++) {
|
||||
struct cell *cell = &grid->cells[i];
|
||||
/* TODO: memset entire range */
|
||||
memset(cell, 0, sizeof(*cell));
|
||||
|
||||
cell->attrs.foreground = grid->foreground;
|
||||
cell->attrs.background = grid->background;
|
||||
|
||||
cell->dirty = true;
|
||||
grid->dirty = true;
|
||||
}
|
||||
|
||||
grid->dirty = true;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
12
vt.c
12
vt.c
|
|
@ -158,10 +158,9 @@ action(struct terminal *term, enum action action, uint8_t c)
|
|||
LOG_DBG("execute: 0x%02x", c);
|
||||
switch (c) {
|
||||
case '\n':
|
||||
LOG_DBG("NEWLINE: %d %d", term->grid.cursor.row, term->grid.rows);
|
||||
if (term->grid.cursor.row == term->grid.rows - 1) {
|
||||
if (term->grid.cursor.row == term->grid.rows - 1)
|
||||
grid_scroll(&term->grid, 1);
|
||||
} else
|
||||
else
|
||||
grid_cursor_down(&term->grid, 1);
|
||||
break;
|
||||
|
||||
|
|
@ -194,11 +193,10 @@ action(struct terminal *term, enum action action, uint8_t c)
|
|||
case ACTION_PRINT: {
|
||||
if (term->grid.print_needs_wrap) {
|
||||
if (term->grid.cursor.row == term->grid.rows - 1) {
|
||||
assert(false);
|
||||
grid_scroll(&term->grid, 1);
|
||||
}
|
||||
|
||||
grid_cursor_to(&term->grid, term->grid.cursor.row + 1, 0);
|
||||
grid_cursor_to(&term->grid, term->grid.cursor.row, 0);
|
||||
} else
|
||||
grid_cursor_to(&term->grid, term->grid.cursor.row + 1, 0);
|
||||
}
|
||||
|
||||
struct cell *cell = &term->grid.cells[term->grid.linear_cursor];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue