terminal: saturate cursor subtraction in resizeCols
PageList.resize takes the .lt branch when columns shrink, which calls resizeWithoutReflow (mutating self.rows to the new smaller value) and then resizeCols with the original opts.cursor.y. When both axes shrink in one call and the cursor sits at or past the new bottom row, the expression `self.rows - c.y - 1` underflows and panics in safety builds. Use saturating subtraction; "remaining rows below cursor" is 0 once the cursor sits at or past the new bottom.pull/12907/head
parent
629838b9bd
commit
7fa6fffbca
|
|
@ -1059,7 +1059,7 @@ fn resizeCols(
|
|||
break :cursor .{
|
||||
.tracked_pin = c.pin orelse try self.trackPin(p),
|
||||
.untrack = c.pin == null,
|
||||
.remaining_rows = self.rows - c.y - 1,
|
||||
.remaining_rows = self.rows -| (c.y + 1),
|
||||
.wrapped_rows = wrapped,
|
||||
};
|
||||
} else null;
|
||||
|
|
@ -1192,7 +1192,7 @@ fn resizeCols(
|
|||
break :wrapped wrapped;
|
||||
};
|
||||
|
||||
const current = self.rows - active_pt.active.y - 1;
|
||||
const current = self.rows -| (active_pt.active.y + 1);
|
||||
|
||||
var req_rows = c.remaining_rows;
|
||||
req_rows -|= wrapped -| c.wrapped_rows;
|
||||
|
|
|
|||
Loading…
Reference in New Issue