this repo has no description
13
fork

Configure Feed

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

widgets(terminal): simplify cursorLeft logic

+12 -16
+10 -4
src/widgets/terminal/Screen.zig
··· 311 311 } 312 312 313 313 pub fn cursorLeft(self: *Screen, n: usize) void { 314 - // default to 1, max of current cursor location 315 - const cnt = @min(self.cursor.col, @max(n, 1)); 316 - 317 314 self.cursor.pending_wrap = false; 318 - self.cursor.col -= cnt; 315 + if (self.withinScrollingRegion()) 316 + self.cursor.col = @max( 317 + self.cursor.col -| n, 318 + self.scrolling_region.left, 319 + ) 320 + else 321 + self.cursor.col = @max( 322 + self.cursor.col -| n, 323 + 0, 324 + ); 319 325 } 320 326 321 327 pub fn eraseRight(self: *Screen) void {
+2 -12
src/widgets/terminal/Terminal.zig
··· 281 281 self.back_screen.width, 282 282 ); 283 283 }, 284 - 'D' => { 284 + 'D', 'j' => { 285 285 self.back_screen.cursor.pending_wrap = false; 286 286 var iter = seq.iterator(u16); 287 287 const delta = iter.next() orelse 1; 288 - const within = self.back_screen.withinScrollingRegion(); 289 - if (within) 290 - self.back_screen.cursor.col = @max( 291 - self.back_screen.cursor.col -| delta, 292 - self.back_screen.scrolling_region.left, 293 - ) 294 - else 295 - self.back_screen.cursor.col = @max( 296 - self.back_screen.cursor.col -| delta, 297 - 0, 298 - ); 288 + self.back_screen.cursorLeft(delta); 299 289 }, 300 290 'H', 'f' => { // CUP 301 291 var iter = seq.iterator(u16);