this repo has no description
13
fork

Configure Feed

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

widgets(terminal): dirty handling, cursor up, cursor shapes

+24 -2
+24 -2
src/widgets/terminal/Terminal.zig
··· 139 139 } 140 140 141 141 pub fn draw(self: *Terminal, win: vaxis.Window) !void { 142 - // TODO: check sync 143 142 if (self.back_mutex.tryLock() and !self.mode.sync) { 144 143 defer self.back_mutex.unlock(); 145 144 try self.back_screen.copyTo(&self.front_screen); ··· 155 154 } 156 155 } 157 156 158 - if (self.front_screen.cursor.visible) 157 + if (self.front_screen.cursor.visible) { 158 + win.setCursorShape(self.front_screen.cursor.shape); 159 159 win.showCursor(self.front_screen.cursor.col, self.front_screen.cursor.row); 160 + } 160 161 } 161 162 162 163 pub fn update(self: *Terminal, event: InputEvent) !void { ··· 220 221 .ss3 => |ss3| std.log.err("unhandled ss3: {c}", .{ss3}), 221 222 .csi => |seq| { 222 223 switch (seq.final) { 224 + 'A' => { 225 + var iter = seq.iterator(u16); 226 + const delta = iter.next() orelse 1; 227 + self.back_screen.cursor.row = self.back_screen.cursor.row -| delta; 228 + }, 223 229 'B' => { // CUD 224 230 var iter = seq.iterator(u16); 225 231 const delta = iter.next() orelse 1; ··· 275 281 self.back_screen.sgr(seq); 276 282 } 277 283 }, 284 + 'q' => { 285 + if (seq.intermediate) |int| { 286 + switch (int) { 287 + ' ' => { 288 + var iter = seq.iterator(u8); 289 + const shape = iter.next() orelse 0; 290 + self.back_screen.cursor.shape = @enumFromInt(shape); 291 + }, 292 + else => {}, 293 + } 294 + } 295 + }, 278 296 else => std.log.err("unhandled CSI: {}", .{seq}), 279 297 } 280 298 }, ··· 316 334 self.back_screen = &self.back_screen_alt 317 335 else 318 336 self.back_screen = &self.back_screen_pri; 337 + var i: usize = 0; 338 + while (i < self.back_screen.buf.len) : (i += 1) { 339 + self.back_screen.buf[i].dirty = true; 340 + } 319 341 }, 320 342 2026 => self.mode.sync = val, 321 343 else => return,