this repo has no description
13
fork

Configure Feed

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

widgets(terminal): support cursor mode

+23
+2
src/widgets/terminal/Screen.zig
··· 27 27 row: usize = 0, 28 28 pending_wrap: bool = false, 29 29 shape: vaxis.Cell.CursorShape = .default, 30 + visible: bool = true, 30 31 31 32 pub fn isOutsideScrollingRegion(self: Cursor, sr: ScrollingRegion) bool { 32 33 return self.row < sr.top or ··· 99 100 100 101 /// copies the visible area to the destination screen 101 102 pub fn copyTo(self: *Screen, dst: *Screen) !void { 103 + dst.cursor = self.cursor; 102 104 for (self.buf, 0..) |cell, i| { 103 105 if (!cell.dirty) continue; 104 106 self.buf[i].dirty = false;
+21
src/widgets/terminal/Terminal.zig
··· 25 25 26 26 pub const Mode = struct { 27 27 origin: bool = false, 28 + cursor: bool = true, 28 29 }; 29 30 30 31 allocator: std.mem.Allocator, ··· 145 146 col += @max(cell.char.width, 1); 146 147 } 147 148 } 149 + 150 + if (self.front_screen.cursor.visible) 151 + win.showCursor(self.front_screen.cursor.col, self.front_screen.cursor.row); 148 152 } 149 153 150 154 fn opaqueRead(ptr: *const anyopaque, buf: []u8) !usize { ··· 199 203 self.back_screen.cursor.col = col - 1; 200 204 self.back_screen.cursor.row = row - 1; 201 205 }, 206 + 'h', 'l' => { 207 + var iter = seq.iterator(u16); 208 + const mode = iter.next() orelse continue; 209 + // There is only one collision (mode = 4), and we don't support the private 210 + // version of it 211 + if (seq.private_marker != null and mode == 4) continue; 212 + self.setMode(mode, seq.final == 'h'); 213 + }, 202 214 'm' => { 203 215 if (seq.intermediate == null and seq.private_marker == null) { 204 216 self.back_screen.sgr(seq); ··· 234 246 else => log.warn("unhandled C0: 0x{x}", .{@intFromEnum(b)}), 235 247 } 236 248 } 249 + 250 + pub fn setMode(self: *Terminal, mode: u16, val: bool) void { 251 + switch (mode) { 252 + 25 => { 253 + self.mode.cursor = val; 254 + }, 255 + else => return, 256 + } 257 + }