summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-09-30 08:10:21 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-09-30 08:10:21 +0000
commita393f0223151ca3781c80612e64f5112b43c3181 (patch)
treed06f5c6df81e2026d74be0d6bc622c4c0c8f2695 /usr.bin/tmux/tty.c
parent4a41707fc9901be89755810a61786285e4f33f13 (diff)
On some Windows terminals, if TIOCWINSZ does not return xpixel and
ypixel (they are zero), if this is the case then try the query escape sequences. From Dmitry Galchinsky in GitHub issue 4099.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 51dd9378efa..83e665f099b 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.438 2024/08/04 09:42:23 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.439 2024/09/30 08:10:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -42,7 +42,6 @@ static void tty_cursor_pane(struct tty *, const struct tty_ctx *, u_int,
u_int);
static void tty_cursor_pane_unless_wrap(struct tty *,
const struct tty_ctx *, u_int, u_int);
-static void tty_invalidate(struct tty *);
static void tty_colours(struct tty *, const struct grid_cell *);
static void tty_check_fg(struct tty *, struct colour_palette *,
struct grid_cell *);
@@ -135,6 +134,14 @@ tty_resize(struct tty *tty)
ypixel = 0;
} else
ypixel = ws.ws_ypixel / sy;
+
+ if ((xpixel == 0 || ypixel == 0) &&
+ tty->out != NULL &&
+ !(tty->flags & TTY_WINSIZEQUERY) &&
+ (tty->term->flags & TERM_VT100LIKE)) {
+ tty_puts(tty, "\033[18t\033[14t");
+ tty->flags |= TTY_WINSIZEQUERY;
+ }
} else {
sx = 80;
sy = 24;
@@ -2247,7 +2254,7 @@ tty_reset(struct tty *tty)
memcpy(&tty->last_cell, &grid_default_cell, sizeof tty->last_cell);
}
-static void
+void
tty_invalidate(struct tty *tty)
{
memcpy(&tty->cell, &grid_default_cell, sizeof tty->cell);