cli/list-keybinds: set vaxis measurement state

This commit is contained in:
Tim Culverhouse
2024-08-06 13:36:27 -05:00
parent b0ac75d5bc
commit e2a59ba77c

View File

@ -81,6 +81,13 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 {
defer tty.deinit(); defer tty.deinit();
var vx = try vaxis.init(alloc, .{}); var vx = try vaxis.init(alloc, .{});
defer vx.deinit(alloc, tty.anyWriter()); defer vx.deinit(alloc, tty.anyWriter());
// We know we are ghostty, so let's enable mode 2027. Vaxis normally does this but you need an
// event loop to auto-enable it.
vx.caps.unicode = .unicode;
try tty.anyWriter().writeAll(vaxis.ctlseqs.unicode_set);
defer tty.anyWriter().writeAll(vaxis.ctlseqs.unicode_reset) catch {};
var buf_writer = tty.bufferedWriter(); var buf_writer = tty.bufferedWriter();
const writer = buf_writer.writer().any(); const writer = buf_writer.writer().any();
@ -90,11 +97,6 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 {
}; };
try vx.resize(alloc, tty.anyWriter(), winsize); try vx.resize(alloc, tty.anyWriter(), winsize);
// We know we are ghostty, so let's enable mode 2027. Vaxis normally does this but you need an
// event loop to auto-enable it.
try tty.anyWriter().writeAll(vaxis.ctlseqs.unicode_set);
defer tty.anyWriter().writeAll(vaxis.ctlseqs.unicode_reset) catch {};
const win = vx.window(); const win = vx.window();
// Get all of our keybinds into a list. We also search for the longest printed keyname so we can // Get all of our keybinds into a list. We also search for the longest printed keyname so we can