this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: implement mode 2048 in band resize reports

Implement mode 2048 for in-band window resize reports.

Reference: https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83

+45 -1
+1
README.md
··· 32 32 | Synchronized Output (DEC 2026) | ✅ | 33 33 | Unicode Core (DEC 2027) | ✅ | 34 34 | Color Mode Updates (DEC 2031) | ✅ | 35 + | [In-Band Resize Reports](https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83) | ✅ | 35 36 | Images (kitty) | ✅ | 36 37 37 38 ## Usage
+8 -1
src/Loop.zig
··· 89 89 90 90 pub fn winsizeCallback(ptr: *anyopaque) void { 91 91 const self: *Self = @ptrCast(@alignCast(ptr)); 92 + // We will be receiving winsize updates in-band 93 + if (self.vaxis.state.in_band_resize) return; 92 94 93 95 const winsize = Tty.getWinsize(self.tty.fd) catch return; 94 96 if (@hasField(Event, "winsize")) { ··· 286 288 .cap_da1 => { 287 289 std.Thread.Futex.wake(&vx.query_futex, 10); 288 290 }, 289 - .winsize => unreachable, // handled elsewhere for posix 291 + .winsize => |winsize| { 292 + vx.state.in_band_resize = true; 293 + if (@hasField(Event, "winsize")) { 294 + self.postEvent(.{ .winsize = winsize }); 295 + } 296 + }, 290 297 } 291 298 }, 292 299 }
+26
src/Parser.zig
··· 6 6 const Mouse = @import("Mouse.zig"); 7 7 const code_point = @import("code_point"); 8 8 const grapheme = @import("grapheme"); 9 + const Winsize = @import("main.zig").Winsize; 9 10 10 11 const log = std.log.scoped(.parser); 11 12 ··· 469 470 }, 470 471 else => return null_event, 471 472 } 473 + }, 474 + 't' => { 475 + // XTWINOPS 476 + // Split first into fields delimited by ';' 477 + var iter = std.mem.splitScalar(u8, sequence[2 .. sequence.len - 1], ';'); 478 + const ps = iter.first(); 479 + if (std.mem.eql(u8, "48", ps)) { 480 + // in band window resize 481 + const width_char = iter.next() orelse return null_event; 482 + const height_char = iter.next() orelse return null_event; 483 + const width_pix = iter.next() orelse "0"; 484 + const height_pix = iter.next() orelse "0"; 485 + 486 + const winsize: Winsize = .{ 487 + .rows = std.fmt.parseUnsigned(usize, height_char, 10) catch return null_event, 488 + .cols = std.fmt.parseUnsigned(usize, width_char, 10) catch return null_event, 489 + .x_pixel = std.fmt.parseUnsigned(usize, width_pix, 10) catch return null_event, 490 + .y_pixel = std.fmt.parseUnsigned(usize, height_pix, 10) catch return null_event, 491 + }; 492 + return .{ 493 + .event = .{ .winsize = winsize }, 494 + .n = sequence.len, 495 + }; 496 + } 497 + return null_event; 472 498 }, 473 499 'u' => { 474 500 // Kitty keyboard
+6
src/Vaxis.zig
··· 85 85 mouse: bool = false, 86 86 pixel_mouse: bool = false, 87 87 color_scheme_updates: bool = false, 88 + in_band_resize: bool = false, 88 89 cursor: struct { 89 90 row: usize = 0, 90 91 col: usize = 0, ··· 150 151 if (self.state.color_scheme_updates) { 151 152 try tty.writeAll(ctlseqs.color_scheme_reset); 152 153 self.state.color_scheme_updates = false; 154 + } 155 + if (self.state.in_band_resize) { 156 + try tty.writeAll(ctlseqs.in_band_resize_reset); 157 + self.state.in_band_resize = false; 153 158 } 154 159 } 155 160 ··· 244 249 try tty.writeAll(ctlseqs.decrqm_sgr_pixels ++ 245 250 ctlseqs.decrqm_unicode ++ 246 251 ctlseqs.decrqm_color_scheme ++ 252 + ctlseqs.in_band_resize_set ++ 247 253 ctlseqs.xtversion ++ 248 254 ctlseqs.csi_u_query ++ 249 255 ctlseqs.kitty_graphics_query ++
+4
src/ctlseqs.zig
··· 20 20 pub const mouse_set_pixels = "\x1b[?1002;1003;1004;1016h"; 21 21 pub const mouse_reset = "\x1b[?1002;1003;1004;1006;1016l"; 22 22 23 + // in-band window size reports 24 + pub const in_band_resize_set = "\x1b[?2048h"; 25 + pub const in_band_resize_reset = "\x1b[?2048l"; 26 + 23 27 // sync 24 28 pub const sync_set = "\x1b[?2026h"; 25 29 pub const sync_reset = "\x1b[?2026l";