aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/terminal.c b/terminal.c
index f1b05f57..dcaca033 100644
--- a/terminal.c
+++ b/terminal.c
@@ -355,8 +355,12 @@ fdm_flash(struct fdm *fdm, int fd, int events, void *data)
(unsigned long long)expiration_count);
term->flash.active = false;
- term_damage_view(term);
render_refresh(term);
+
+ /* Work around Sway bug - unmapping a sub-surface does not damage
+ * the underlying surface */
+ term_damage_margins(term);
+ term_damage_view(term);
return true;
}
@@ -1925,6 +1929,16 @@ term_reset(struct terminal *term, bool hard)
tll_free(term->alt.scroll_damage);
term->render.last_cursor.row = NULL;
term_damage_all(term);
+
+ term->sixel.scrolling = true;
+ term->sixel.cursor_right_of_graphics = false;
+ term->sixel.use_private_palette = true;
+ term->sixel.max_width = SIXEL_MAX_WIDTH;
+ term->sixel.max_height = SIXEL_MAX_HEIGHT;
+ term->sixel.palette_size = SIXEL_MAX_COLORS;
+ free(term->sixel.private_palette);
+ free(term->sixel.shared_palette);
+ term->sixel.private_palette = term->sixel.shared_palette = NULL;
}
static bool
@@ -2154,18 +2168,18 @@ term_erase(struct terminal *term, int start_row, int start_col,
void
term_erase_scrollback(struct terminal *term)
{
- const int num_rows = term->grid->num_rows;
+ const struct grid *grid = term->grid;
+ const int num_rows = grid->num_rows;
const int mask = num_rows - 1;
- const int start = (term->grid->offset + term->rows) & mask;
- const int end = (term->grid->offset - 1) & mask;
+ const int start = (grid->offset + term->rows) & mask;
+ const int end = (grid->offset - 1) & mask;
- const int scrollback_start = term->grid->offset + term->rows;
- const int rel_start = (start - scrollback_start + num_rows) & mask;
- const int rel_end = (end - scrollback_start + num_rows) & mask;
+ const int rel_start = grid_row_abs_to_sb(grid, term->rows, start);
+ const int rel_end = grid_row_abs_to_sb(grid, term->rows, end);
- const int sel_start = term->selection.coords.start.row;
- const int sel_end = term->selection.coords.end.row;
+ const int sel_start = selection_get_start(term).row;
+ const int sel_end = selection_get_end(term).row;
if (sel_end >= 0) {
/*
@@ -2183,8 +2197,8 @@ term_erase_scrollback(struct terminal *term)
* closer to the screen bottom.
*/
- const int rel_sel_start = (sel_start - scrollback_start + num_rows) & mask;
- const int rel_sel_end = (sel_end - scrollback_start + num_rows) & mask;
+ const int rel_sel_start = grid_row_abs_to_sb(grid, term->rows, sel_start);
+ const int rel_sel_end = grid_row_abs_to_sb(grid, term->rows, sel_end);
if ((rel_sel_start <= rel_start && rel_sel_end >= rel_start) ||
(rel_sel_start <= rel_end && rel_sel_end >= rel_end) ||
@@ -2196,8 +2210,9 @@ term_erase_scrollback(struct terminal *term)
tll_foreach(term->grid->sixel_images, it) {
struct sixel *six = &it->item;
- const int six_start = (six->pos.row - scrollback_start + num_rows) & mask;
- const int six_end = (six->pos.row + six->rows - 1 - scrollback_start + num_rows) & mask;
+ const int six_start = grid_row_abs_to_sb(grid, term->rows, six->pos.row);
+ const int six_end = grid_row_abs_to_sb(
+ grid, term->rows, six->pos.row + six->rows - 1);
if ((six_start <= rel_start && six_end >= rel_start) ||
(six_start <= rel_end && six_end >= rel_end) ||