summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 17:18:36 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit2d007737eb6f7f8e48bf6500e19ed44e62df5aa7 (patch)
treeb97083ee6e8be0579abe974fc10f28353d586c32 /src/tty
parente6745a1756c50dd78c4b85641bd2f0e67681dc5d (diff)
downloadpardes-2d007737eb6f7f8e48bf6500e19ed44e62df5aa7.tar.gz
pardes-2d007737eb6f7f8e48bf6500e19ed44e62df5aa7.zip
The terminal's capabilities are taken up when its answer comes, not at the first key after it
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/tty.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index 97c720ea..efccd98e 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -178,6 +178,13 @@ fn readInput(loop: *Loop, tty: anytype, cache: *vaxis.GraphemeCache) !void {
if (event == .paste) if (loop.vaxis.opts.system_clipboard_allocator) |gpa| gpa.free(@constCast(event.paste));
return err;
};
+ // The last answer to the startup queries is no event of its
+ // own: wake the loop so it takes the capabilities up (pollFrame)
+ // now. Left to the first key, that key paid for the full redraw
+ // they cost, and kitty's keys came in the legacy way till then.
+ if (result.event) |event| if (event == .cap_da1) {
+ _ = loop.tryPostEvent(.nop) catch {};
+ };
}
carried = end - consumed;
std.mem.copyForwards(u8, buf[0..carried], buf[consumed..end]);
@@ -276,6 +283,8 @@ test "terminal input preserves fragmented keys queries paste and text after EOF"
try std.testing.expectEqualStrings("clip", bytes);
clipboard = true;
},
+ // The device attributes' wake (a capability answer).
+ .nop => try std.testing.expect(vx.queries_done.load(.unordered)),
else => return error.UnexpectedInputEvent,
};
try std.testing.expectEqualStrings("plain café 界 😀tail", text.items);
@@ -358,6 +367,7 @@ test "terminal replies and malformed sequences never become typed text" {
try std.testing.expectEqual(@as(i16, 0), mouse.col);
clicked = true;
},
+ .nop => {}, // the device attributes' wake
else => return error.UnexpectedInputEvent,
};
try std.testing.expectEqualStrings("abc", text.items);
@@ -1420,6 +1430,7 @@ const Shell = struct {
s.core.native_images = s.vx.caps.kitty_graphics;
if (s.vx.caps.kitty_graphics) kittyShmProbe(s.tty.writer());
s.vx.queueRefresh();
+ s.core.needs_frame = true;
}
}