From e2a59ba77c4370bea526dba7f32e4b01b0b28c77 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 6 Aug 2024 13:36:27 -0500 Subject: [PATCH] cli/list-keybinds: set vaxis measurement state --- src/cli/list_keybinds.zig | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cli/list_keybinds.zig b/src/cli/list_keybinds.zig index f301ea578..f61058258 100644 --- a/src/cli/list_keybinds.zig +++ b/src/cli/list_keybinds.zig @@ -81,6 +81,13 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 { defer tty.deinit(); var vx = try vaxis.init(alloc, .{}); 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(); 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); - // 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(); // Get all of our keybinds into a list. We also search for the longest printed keyname so we can