this repo has no description
13
fork

Configure Feed

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

widgets(terminal): more c0 control impls

+35 -2
+8
src/widgets/terminal/Screen.zig
··· 331 331 } 332 332 } 333 333 } 334 + 335 + pub fn cursorLeft(self: *Screen, n: usize) void { 336 + // default to 1, max of current cursor location 337 + const cnt = @min(self.cursor.col, @max(n, 1)); 338 + 339 + self.cursor.pending_wrap = false; 340 + self.cursor.col -= cnt; 341 + }
+27 -2
src/widgets/terminal/Terminal.zig
··· 22 22 winsize: Winsize = .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }, 23 23 }; 24 24 25 + pub const Mode = struct { 26 + origin: bool = false, 27 + }; 28 + 25 29 allocator: std.mem.Allocator, 26 30 scrollback_size: usize, 27 31 ··· 43 47 44 48 unicode: *const vaxis.Unicode, 45 49 should_quit: bool = false, 50 + 51 + mode: Mode = .{}, 52 + 53 + pending_events: struct { 54 + bell: std.atomic.Value(bool) = std.atomic.Value(bool).init(false), 55 + } = .{}, 46 56 47 57 /// initialize a Terminal. This sets the size of the underlying pty and allocates the sizes of the 48 58 /// screen ··· 218 228 219 229 inline fn handleC0(self: *Terminal, b: u8) !void { 220 230 switch (b) { 221 - 0x0a, 0x0b, 0x0c => try self.back_screen.index(), // line feed 222 - 0x0d => {}, // carriage return 231 + 0x00, 0x01, 0x02 => {}, // NUL, SOH, STX 232 + 0x05 => {}, // ENQ 233 + 0x07 => self.pending_events.bell.store(true, .unordered), // BEL 234 + 0x08 => self.back_screen.cursorLeft(1), // BS 235 + 0x09 => {}, // TODO: HT 236 + 0x0a, 0x0b, 0x0c => try self.back_screen.index(), // LF, VT, FF 237 + 0x0d => { // CR 238 + self.back_screen.cursor.pending_wrap = false; 239 + self.back_screen.cursor.col = if (self.mode.origin) 240 + self.back_screen.scrolling_region.left 241 + else if (self.back_screen.cursor.col >= self.back_screen.scrolling_region.left) 242 + self.back_screen.scrolling_region.left 243 + else 244 + 0; 245 + }, 246 + 0x0e => {}, // TODO: Charset shift out 247 + 0x0f => {}, // TODO: Charset shift in 223 248 else => log.warn("unhandled C0: 0x{x}", .{b}), 224 249 } 225 250 }