summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/detached/server.zig4
-rw-r--r--test/fs.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/detached/server.zig b/src/detached/server.zig
index 588912bb..79d1189a 100644
--- a/src/detached/server.zig
+++ b/src/detached/server.zig
@@ -549,7 +549,9 @@ pub const Session = struct {
if (pane >= s.ptys.len) return;
const fd = s.ptys[pane].fd;
if (fd < 0) return;
- const ws: posix.winsize = .{ .row = rows, .col = cols, .xpixel = 0, .ypixel = 0 };
+ // In pixels too, at the last frontend's cell size (8x16 before
+ // one attached): a program sizes its kitty graphics by them.
+ const ws = host_io.ptyWinsize(s.core, cols, rows);
_ = posix.system.ioctl(fd, TIOCSWINSZ, @intFromPtr(&ws));
}
diff --git a/test/fs.py b/test/fs.py
index 789021bd..2507e4f8 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -479,6 +479,11 @@ def run_file(binary):
assert run(client, term, b'fi\n') == b'error not run\n' # a syntax error runs nothing
assert run(client, term, b"echo 'open\n") == b'error not run\n' # nor does an open quote
assert run(client, term, b'true\n') == b'exit 0\n' # ...and the shell is clear after
+ # With no frontend attached the pty's size is in pixels too, at a
+ # nominal 8x16 cell: a program sizes its kitty graphics by it.
+ said = run(client, term, b'python3 -c \'import fcntl,termios,struct;print(*struct.unpack("4H",fcntl.ioctl(0,termios.TIOCGWINSZ,bytes(8))))\'\n')
+ rows, cols, xpixel, ypixel = map(int, said.split(b'\n')[1].split())
+ assert (xpixel, ypixel) == (cols * 8, rows * 16) and xpixel > 0, said
# A paging command run through pty/run does not wait in less: the
# terminal's PAGER is `pardes -`, and its text is a +Pager pane.
if shutil.which('git'):