aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-06-29 20:03:26 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-06-29 20:03:26 +0000
commitfad5838dbaba327ea16496bbe768056b10041897 (patch)
tree53a4cd6d93af11103fc8e78f09341397b3b28ca4 /terminal.c
parentscroll: destroy scrolled out sixels before scroll is applied (diff)
parentsixel: destroy all sixels when font size is decreased (diff)
Merge branch 'master' into sixel-performance
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/terminal.c b/terminal.c
index 2497dde5..c5960c90 100644
--- a/terminal.c
+++ b/terminal.c
@@ -36,7 +36,7 @@
static const char *const XCURSOR_LEFT_PTR = "left_ptr";
static const char *const XCURSOR_TEXT = "text";
-static const char *const XCURSOR_HAND2 = "hand2";
+//static const char *const XCURSOR_HAND2 = "hand2";
bool
term_to_slave(struct terminal *term, const void *_data, size_t len)
@@ -1423,7 +1423,30 @@ term_font_size_adjust(struct terminal *term, double amount)
return false;
}
- term_set_fonts(term, (struct fcft_font *[]){data[0].font_out, data[1].font_out, data[2].font_out, data[3].font_out});
+ const int old_cell_width = term->cell_width;
+ const int old_cell_height = term->cell_height;
+
+ if (!term_set_fonts(term, (struct fcft_font *[]){data[0].font_out, data[1].font_out, data[2].font_out, data[3].font_out}))
+ return false;
+
+ if (term->cell_width < old_cell_width ||
+ term->cell_height < old_cell_height)
+ {
+ /*
+ * The cell size has decreased.
+ *
+ * This means sixels, which we cannot resize, no longer fit
+ * into their "allocated" grid space.
+ *
+ * To be able to fit them, we would have to change the grid
+ * content. Inserting empty lines _might_ seem acceptable, but
+ * we'd also need to insert empty columns, which would break
+ * existing layout completely.
+ *
+ * So we delete them.
+ */
+ sixel_destroy_all(term);
+ }
return true;
}
@@ -2206,9 +2229,9 @@ void
term_xcursor_update(struct terminal *term)
{
term->xcursor =
- term->is_searching ? XCURSOR_LEFT_PTR :
+ term->is_searching ? XCURSOR_LEFT_PTR : /* TODO: something different? */
selection_enabled(term) ? XCURSOR_TEXT :
- XCURSOR_HAND2;
+ XCURSOR_LEFT_PTR;
render_xcursor_set(term);
}