mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-30 11:10:23 -04:00
url-mode: dirty the “last cursor” cell before taking the snapshot
This ensures the “last cursor” cell is re-drawn (without a cursor, if the cursor has moved), both in the snapshot:ed grid, and later, when we switch back to the real grid. We must also be careful and reset term->render.last_cursor.row both when *entering* and *leaving* URL mode, to ensure it doesn’t point to an invalid row.
This commit is contained in:
parent
aa10cd54ea
commit
bc71e06d5f
1 changed files with 20 additions and 0 deletions
20
url-mode.c
20
url-mode.c
|
|
@ -637,6 +637,17 @@ urls_render(struct terminal *term)
|
||||||
tag_cells_for_url(term, &it->item, true);
|
tag_cells_for_url(term, &it->item, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dirty the last cursor, to ensure it is erased */
|
||||||
|
{
|
||||||
|
struct row *cursor_row = term->render.last_cursor.row;
|
||||||
|
if (cursor_row != NULL) {
|
||||||
|
struct cell *cell = &cursor_row->cells[term->render.last_cursor.col];
|
||||||
|
cell->attrs.clean = 0;
|
||||||
|
cursor_row->dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
term->render.last_cursor.row = NULL;
|
||||||
|
|
||||||
/* Snapshot the current grid */
|
/* Snapshot the current grid */
|
||||||
term->url_grid_snapshot = grid_snapshot(term->grid);
|
term->url_grid_snapshot = grid_snapshot(term->grid);
|
||||||
|
|
||||||
|
|
@ -662,6 +673,15 @@ urls_reset(struct terminal *term)
|
||||||
grid_free(term->url_grid_snapshot);
|
grid_free(term->url_grid_snapshot);
|
||||||
free(term->url_grid_snapshot);
|
free(term->url_grid_snapshot);
|
||||||
term->url_grid_snapshot = NULL;
|
term->url_grid_snapshot = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure “last cursor” doesn’t point to a row in the just
|
||||||
|
* free:d snapshot grid.
|
||||||
|
*
|
||||||
|
* Note that it will still be erased properly (if hasn’t already),
|
||||||
|
* since we marked the cell as dirty *before* taking the grid
|
||||||
|
* snapshot.
|
||||||
|
*/
|
||||||
term->render.last_cursor.row = NULL;
|
term->render.last_cursor.row = NULL;
|
||||||
|
|
||||||
if (term->window != NULL) {
|
if (term->window != NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue