mirror of
https://github.com/tmux/tmux.git
synced 2026-10-15 16:04:34 +00:00
Update sizes on WINSZ.
This commit is contained in:
@@ -9,9 +9,10 @@ TERM=screen
|
|||||||
|
|
||||||
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
|
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
|
||||||
|
|
||||||
python3 - "$TEST_TMUX" <<'PY'
|
python3 -B - "$TEST_TMUX" <<'PY'
|
||||||
import fcntl
|
import fcntl
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import select
|
import select
|
||||||
import struct
|
import struct
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -94,6 +95,13 @@ for name, report in reports:
|
|||||||
run("new-session", "-d", "-s", "replies", "-x", "80",
|
run("new-session", "-d", "-s", "replies", "-x", "80",
|
||||||
"-y", "24", "stty raw -echo; exec cat -v")
|
"-y", "24", "stty raw -echo; exec cat -v")
|
||||||
run("set-option", "-g", "status", "off")
|
run("set-option", "-g", "status", "off")
|
||||||
|
if name == "pixels":
|
||||||
|
# Draw the window cell size so it can be read from the
|
||||||
|
# client's output without running another command, since
|
||||||
|
# each command's client recalculates the window sizes.
|
||||||
|
run("set-option", "-g", "status", "on")
|
||||||
|
run("set-option", "-g", "status-format[0]",
|
||||||
|
"W=#{window_cell_width}x#{window_cell_height}")
|
||||||
run("set-option", "-g", "assume-paste-time", "0")
|
run("set-option", "-g", "assume-paste-time", "0")
|
||||||
if delivery == "expired":
|
if delivery == "expired":
|
||||||
run("set-option", "-s", "escape-time", "100")
|
run("set-option", "-s", "escape-time", "100")
|
||||||
@@ -128,6 +136,7 @@ for name, report in reports:
|
|||||||
chunks = [wire[:-1], wire[-1:]]
|
chunks = [wire[:-1], wire[-1:]]
|
||||||
else:
|
else:
|
||||||
chunks = [wire[i:i+1] for i in range(len(wire))]
|
chunks = [wire[i:i+1] for i in range(len(wire))]
|
||||||
|
output = b""
|
||||||
for part in chunks[:-1]:
|
for part in chunks[:-1]:
|
||||||
os.write(fd, part)
|
os.write(fd, part)
|
||||||
time.sleep(.01)
|
time.sleep(.01)
|
||||||
@@ -151,12 +160,21 @@ for name, report in reports:
|
|||||||
# A trailing key confirms that the entire reply has been
|
# A trailing key confirms that the entire reply has been
|
||||||
# processed, including cases with no extra Escape.
|
# processed, including cases with no extra Escape.
|
||||||
os.write(fd, chunks[-1] + b"Z")
|
os.write(fd, chunks[-1] + b"Z")
|
||||||
|
if name == "pixels":
|
||||||
|
# With no command run since the reply, the window must
|
||||||
|
# have followed the client's new cell size by itself.
|
||||||
|
time.sleep(.3)
|
||||||
|
while select.select([fd], [], [], .2)[0]:
|
||||||
|
output += os.read(fd, 65536)
|
||||||
|
drawn = re.findall(rb"W=(\d+x\d+)", output)
|
||||||
|
assert drawn and drawn[-1] == b"10x20", (
|
||||||
|
context, "window cell size", drawn)
|
||||||
deadline = time.monotonic() + 5
|
deadline = time.monotonic() + 5
|
||||||
while run("capture-pane", "-p") != expected:
|
while run("capture-pane", "-p") != expected:
|
||||||
assert time.monotonic() < deadline, (context,
|
assert time.monotonic() < deadline, (context,
|
||||||
"reply leaked or input stalled", run("capture-pane", "-p"))
|
"reply leaked or input stalled", run("capture-pane", "-p"))
|
||||||
if select.select([fd], [], [], .01)[0]:
|
if select.select([fd], [], [], .01)[0]:
|
||||||
os.read(fd, 65536)
|
output += os.read(fd, 65536)
|
||||||
actual = state()
|
actual = state()
|
||||||
if delivery in ("invalid", "expired"):
|
if delivery in ("invalid", "expired"):
|
||||||
assert actual == baseline, (context, "unexpected effect", actual)
|
assert actual == baseline, (context, "unexpected effect", actual)
|
||||||
|
|||||||
@@ -1928,6 +1928,7 @@ tty_keys_winsz(struct tty *tty, const char *buf, size_t len, size_t *size,
|
|||||||
if (tty_set_size(tty, tty->sx, tty->sy, char_x, char_y))
|
if (tty_set_size(tty, tty->sx, tty->sy, char_x, char_y))
|
||||||
server_redraw_client(c);
|
server_redraw_client(c);
|
||||||
tty_invalidate(tty);
|
tty_invalidate(tty);
|
||||||
|
recalculate_sizes();
|
||||||
|
|
||||||
tty->flags &= ~TTY_WINSIZEQUERY;
|
tty->flags &= ~TTY_WINSIZEQUERY;
|
||||||
return (0);
|
return (0);
|
||||||
|
|||||||
Reference in New Issue
Block a user