aboutsummaryrefslogtreecommitdiff
path: root/csi.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-24 17:38:11 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-24 17:38:11 +0000
commitd804bc8579c93a57f16214a04b5b625ae380eb78 (patch)
tree3f0409c4233726c8e3a49c86c8cbcee8160e5758 /csi.c
parentcsi: delete all sixels on the 'alt' grid when switching back to 'normal' (diff)
term: resize: pre-calculate right/bottom margins
Diffstat (limited to 'csi.c')
-rw-r--r--csi.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/csi.c b/csi.c
index ea2b97e6..9b00c3ef 100644
--- a/csi.c
+++ b/csi.c
@@ -791,19 +791,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
case 24: LOG_WARN("unimplemented: resize window (DECSLPP)"); break;
case 14: { /* report window size in pixels */
- const int x_margin = term->x_margin;
- const int y_margin = term->y_margin;
- const int cell_width = term->cols * term->cell_width;
- const int cell_height = term->rows * term->cell_height;
-
- /* right+bottom margins */
- const int r_margin = term->width - cell_width - x_margin;
- const int b_margin = term->height - cell_height - y_margin;
-
char reply[64];
snprintf(reply, sizeof(reply), "\033[4;%d;%dt",
- term->height - y_margin - b_margin,
- term->width - x_margin - r_margin);
+ term->height - term->margins.top - term->margins.bottom,
+ term->width - term->margins.left - term->margins.right);
term_to_slave(term, reply, strlen(reply));
break;
}