mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
update to latest zig which renames @min/@max
This commit is contained in:
6
flake.lock
generated
6
flake.lock
generated
@ -109,11 +109,11 @@
|
|||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1665922169,
|
"lastModified": 1666181436,
|
||||||
"narHash": "sha256-+NmtznNb+iEZP+KK69d10Q1CjSupSXn7ZLuI+tjY+eg=",
|
"narHash": "sha256-BfVbxHew4bLVXYms5eUiKL7jbaI+Hp6TF2PH2Vb62cg=",
|
||||||
"owner": "mitchellh",
|
"owner": "mitchellh",
|
||||||
"repo": "zig-overlay",
|
"repo": "zig-overlay",
|
||||||
"rev": "9fd4058448eecd25be1f465ea9dc22023c86207b",
|
"rev": "cf94d6039dd8205e48013eaef619da6a52bdc34e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -712,7 +712,7 @@ pub fn setScreenSize(self: *Grid, dim: ScreenSize) !void {
|
|||||||
// Update our LRU. We arbitrarily support a certain number of pages here.
|
// Update our LRU. We arbitrarily support a certain number of pages here.
|
||||||
// We also always support a minimum number of caching in case a user
|
// We also always support a minimum number of caching in case a user
|
||||||
// is resizing tiny then growing again we can save some of the renders.
|
// is resizing tiny then growing again we can save some of the renders.
|
||||||
const evicted = try self.cells_lru.resize(self.alloc, @maximum(80, self.size.rows * 10));
|
const evicted = try self.cells_lru.resize(self.alloc, @max(80, self.size.rows * 10));
|
||||||
if (evicted) |list| for (list) |*value| value.deinit(self.alloc);
|
if (evicted) |list| for (list) |*value| value.deinit(self.alloc);
|
||||||
|
|
||||||
// Update our shaper
|
// Update our shaper
|
||||||
|
@ -605,7 +605,7 @@ fn queueWrite(self: *Window, data: []const u8) !void {
|
|||||||
while (i < data.len) {
|
while (i < data.len) {
|
||||||
const req = try self.write_req_pool.get();
|
const req = try self.write_req_pool.get();
|
||||||
const buf = try self.write_buf_pool.get();
|
const buf = try self.write_buf_pool.get();
|
||||||
const end = @minimum(data.len, i + buf.len);
|
const end = @min(data.len, i + buf.len);
|
||||||
std.mem.copy(u8, buf, data[i..end]);
|
std.mem.copy(u8, buf, data[i..end]);
|
||||||
try self.pty_stream.write(
|
try self.pty_stream.write(
|
||||||
.{ .req = req },
|
.{ .req = req },
|
||||||
@ -1007,7 +1007,7 @@ fn scrollCallback(window: glfw.Window, xoff: f64, yoff: f64) void {
|
|||||||
|
|
||||||
// Positive is up
|
// Positive is up
|
||||||
const sign: isize = if (yoff > 0) -1 else 1;
|
const sign: isize = if (yoff > 0) -1 else 1;
|
||||||
const delta: isize = sign * @maximum(@divFloor(win.grid.size.rows, 15), 1);
|
const delta: isize = sign * @max(@divFloor(win.grid.size.rows, 15), 1);
|
||||||
log.info("scroll: delta={}", .{delta});
|
log.info("scroll: delta={}", .{delta});
|
||||||
win.terminal.scrollViewport(.{ .delta = delta }) catch |err|
|
win.terminal.scrollViewport(.{ .delta = delta }) catch |err|
|
||||||
log.err("error scrolling viewport err={}", .{err});
|
log.err("error scrolling viewport err={}", .{err});
|
||||||
@ -1450,13 +1450,13 @@ fn posToViewport(self: Window, xpos: f64, ypos: f64) terminal.point.Viewport {
|
|||||||
|
|
||||||
// Can be off the screen if the user drags it out, so max
|
// Can be off the screen if the user drags it out, so max
|
||||||
// it out on our available columns
|
// it out on our available columns
|
||||||
break :x @minimum(x, self.terminal.cols - 1);
|
break :x @min(x, self.terminal.cols - 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
.y = if (ypos < 0) 0 else y: {
|
.y = if (ypos < 0) 0 else y: {
|
||||||
const cell_height = @floatCast(f64, self.grid.cell_size.height);
|
const cell_height = @floatCast(f64, self.grid.cell_size.height);
|
||||||
const y = @floatToInt(usize, ypos / cell_height);
|
const y = @floatToInt(usize, ypos / cell_height);
|
||||||
break :y @minimum(y, self.terminal.rows - 1);
|
break :y @min(y, self.terminal.rows - 1);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ pub const Face = struct {
|
|||||||
var max: f64 = 0;
|
var max: f64 = 0;
|
||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
while (i < advances.len) : (i += 1) {
|
while (i < advances.len) : (i += 1) {
|
||||||
max = @maximum(advances[i].width, max);
|
max = @max(advances[i].width, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
break :cell_width @floatCast(f32, max);
|
break :cell_width @floatCast(f32, max);
|
||||||
|
@ -363,9 +363,9 @@ pub const Face = struct {
|
|||||||
break :underscore 0;
|
break :underscore 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
break :cell_height @maximum(
|
break :cell_height @max(
|
||||||
face_height,
|
face_height,
|
||||||
@maximum(max_glyph_height, underscore_height),
|
@max(max_glyph_height, underscore_height),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ pub const Face = struct {
|
|||||||
// cell height (mainly: non-scalable fonts, i.e. emoji)
|
// cell height (mainly: non-scalable fonts, i.e. emoji)
|
||||||
break :underline_pos cell_height - 1;
|
break :underline_pos cell_height - 1;
|
||||||
};
|
};
|
||||||
const underline_thickness = @maximum(1, fontUnitsToPxY(
|
const underline_thickness = @max(1, fontUnitsToPxY(
|
||||||
face,
|
face,
|
||||||
face.handle.*.underline_thickness,
|
face.handle.*.underline_thickness,
|
||||||
));
|
));
|
||||||
@ -415,7 +415,7 @@ pub const Face = struct {
|
|||||||
|
|
||||||
break :pos @intToFloat(f32, ascender_px - declared_px);
|
break :pos @intToFloat(f32, ascender_px - declared_px);
|
||||||
},
|
},
|
||||||
.thickness = @maximum(1, fontUnitsToPxY(face, os2.yStrikeoutSize)),
|
.thickness = @max(1, fontUnitsToPxY(face, os2.yStrikeoutSize)),
|
||||||
} else .{
|
} else .{
|
||||||
.pos = cell_baseline * 0.6,
|
.pos = cell_baseline * 0.6,
|
||||||
.thickness = underline_thickness,
|
.thickness = underline_thickness,
|
||||||
|
@ -397,7 +397,7 @@ pub const Row = struct {
|
|||||||
self.storage[0].header.flags.dirty = true;
|
self.storage[0].header.flags.dirty = true;
|
||||||
|
|
||||||
// If the source has no graphemes (likely) then this is fast.
|
// If the source has no graphemes (likely) then this is fast.
|
||||||
const end = @minimum(src.storage.len, self.storage.len);
|
const end = @min(src.storage.len, self.storage.len);
|
||||||
if (!src.storage[0].header.flags.grapheme) {
|
if (!src.storage[0].header.flags.grapheme) {
|
||||||
std.mem.copy(StorageCell, self.storage[1..], src.storage[1..end]);
|
std.mem.copy(StorageCell, self.storage[1..], src.storage[1..end]);
|
||||||
return;
|
return;
|
||||||
@ -586,7 +586,7 @@ pub const RowIndexTag = enum {
|
|||||||
|
|
||||||
// Viewport can be any of the written rows or the max size
|
// Viewport can be any of the written rows or the max size
|
||||||
// of a viewport.
|
// of a viewport.
|
||||||
.viewport => @minimum(screen.rows, screen.rowsWritten()),
|
.viewport => @min(screen.rows, screen.rowsWritten()),
|
||||||
|
|
||||||
// History is all the way up to the top of our active area. If
|
// History is all the way up to the top of our active area. If
|
||||||
// we haven't filled our active area, there is no history.
|
// we haven't filled our active area, there is no history.
|
||||||
@ -596,7 +596,7 @@ pub const RowIndexTag = enum {
|
|||||||
// written here because this is the only row index that can
|
// written here because this is the only row index that can
|
||||||
// actively grow our rows.
|
// actively grow our rows.
|
||||||
.active => screen.rows,
|
.active => screen.rows,
|
||||||
//TODO .active => @minimum(rows_written, screen.rows),
|
//TODO .active => @min(rows_written, screen.rows),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -751,7 +751,7 @@ pub fn init(
|
|||||||
// * Our buffer size is preallocated to fit double our visible space
|
// * Our buffer size is preallocated to fit double our visible space
|
||||||
// or the maximum scrollback whichever is smaller.
|
// or the maximum scrollback whichever is smaller.
|
||||||
// * We add +1 to cols to fit the row header
|
// * We add +1 to cols to fit the row header
|
||||||
const buf_size = (rows + @minimum(max_scrollback, rows)) * (cols + 1);
|
const buf_size = (rows + @min(max_scrollback, rows)) * (cols + 1);
|
||||||
|
|
||||||
return Screen{
|
return Screen{
|
||||||
.alloc = alloc,
|
.alloc = alloc,
|
||||||
@ -943,7 +943,7 @@ fn scrollDelta(self: *Screen, delta: isize, grow: bool) !void {
|
|||||||
// If we're scrolling down and not growing, then we just
|
// If we're scrolling down and not growing, then we just
|
||||||
// add to the viewport and clamp at the bottom.
|
// add to the viewport and clamp at the bottom.
|
||||||
if (!grow) {
|
if (!grow) {
|
||||||
self.viewport = @minimum(
|
self.viewport = @min(
|
||||||
self.history,
|
self.history,
|
||||||
self.viewport + @intCast(usize, delta),
|
self.viewport + @intCast(usize, delta),
|
||||||
);
|
);
|
||||||
@ -976,15 +976,15 @@ fn scrollDelta(self: *Screen, delta: isize, grow: bool) !void {
|
|||||||
// of what we actually need and two pages. We don't want to
|
// of what we actually need and two pages. We don't want to
|
||||||
// allocate one row at a time (common for scrolling) so we do this
|
// allocate one row at a time (common for scrolling) so we do this
|
||||||
// to chunk it.
|
// to chunk it.
|
||||||
const needed_capacity = @maximum(
|
const needed_capacity = @max(
|
||||||
rows_final * (self.cols + 1),
|
rows_final * (self.cols + 1),
|
||||||
@minimum(self.storage.capacity() * 2, max_capacity),
|
@min(self.storage.capacity() * 2, max_capacity),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Allocate what we can.
|
// Allocate what we can.
|
||||||
try self.storage.resize(
|
try self.storage.resize(
|
||||||
self.alloc,
|
self.alloc,
|
||||||
@minimum(max_capacity, needed_capacity),
|
@min(max_capacity, needed_capacity),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1076,7 +1076,7 @@ pub fn selectionString(self: *Screen, alloc: Allocator, sel: Selection) ![:0]con
|
|||||||
|
|
||||||
// Our end index is usually a full row, but if we're the final
|
// Our end index is usually a full row, but if we're the final
|
||||||
// row then we just use the length.
|
// row then we just use the length.
|
||||||
const end_idx = @minimum(slice.len, start_idx + self.cols + 1);
|
const end_idx = @min(slice.len, start_idx + self.cols + 1);
|
||||||
|
|
||||||
// We may have to skip some cells from the beginning if we're
|
// We may have to skip some cells from the beginning if we're
|
||||||
// the first row.
|
// the first row.
|
||||||
@ -1206,9 +1206,9 @@ pub fn resizeWithoutReflow(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
// Calculate our buffer size. This is going to be either the old data
|
// Calculate our buffer size. This is going to be either the old data
|
||||||
// with scrollback or the max capacity of our new size. We prefer the old
|
// with scrollback or the max capacity of our new size. We prefer the old
|
||||||
// length so we can save all the data (ignoring col truncation).
|
// length so we can save all the data (ignoring col truncation).
|
||||||
const old_len = @maximum(old.rowsWritten(), rows) * (cols + 1);
|
const old_len = @max(old.rowsWritten(), rows) * (cols + 1);
|
||||||
const new_max_capacity = self.maxCapacity();
|
const new_max_capacity = self.maxCapacity();
|
||||||
const buf_size = @minimum(old_len, new_max_capacity);
|
const buf_size = @min(old_len, new_max_capacity);
|
||||||
|
|
||||||
// Reallocate the storage
|
// Reallocate the storage
|
||||||
self.storage = try StorageBuf.init(self.alloc, buf_size);
|
self.storage = try StorageBuf.init(self.alloc, buf_size);
|
||||||
@ -1243,7 +1243,7 @@ pub fn resizeWithoutReflow(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
// screen we can accomodate keeping it on the same place if we retain
|
// screen we can accomodate keeping it on the same place if we retain
|
||||||
// the same scrollback.
|
// the same scrollback.
|
||||||
const old_cursor_y_screen = RowIndexTag.active.index(old.cursor.y).toScreen(&old).screen;
|
const old_cursor_y_screen = RowIndexTag.active.index(old.cursor.y).toScreen(&old).screen;
|
||||||
self.cursor.x = @minimum(old.cursor.x, self.cols - 1);
|
self.cursor.x = @min(old.cursor.x, self.cols - 1);
|
||||||
self.cursor.y = if (old_cursor_y_screen <= RowIndexTag.screen.maxLen(self))
|
self.cursor.y = if (old_cursor_y_screen <= RowIndexTag.screen.maxLen(self))
|
||||||
old_cursor_y_screen -| self.history
|
old_cursor_y_screen -| self.history
|
||||||
else
|
else
|
||||||
@ -1282,7 +1282,7 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
errdefer self.* = old;
|
errdefer self.* = old;
|
||||||
|
|
||||||
// Allocate enough to store our screen plus history.
|
// Allocate enough to store our screen plus history.
|
||||||
const buf_size = (self.rows + @maximum(self.history, self.max_scrollback)) * (cols + 1);
|
const buf_size = (self.rows + @max(self.history, self.max_scrollback)) * (cols + 1);
|
||||||
self.storage = try StorageBuf.init(self.alloc, buf_size);
|
self.storage = try StorageBuf.init(self.alloc, buf_size);
|
||||||
errdefer self.storage.deinit(self.alloc);
|
errdefer self.storage.deinit(self.alloc);
|
||||||
defer old.storage.deinit(self.alloc);
|
defer old.storage.deinit(self.alloc);
|
||||||
@ -1356,7 +1356,7 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
const wrapped_cells_rem = wrapped_cells.len - wrapped_i;
|
const wrapped_cells_rem = wrapped_cells.len - wrapped_i;
|
||||||
|
|
||||||
// We copy as much as we can into our new row
|
// We copy as much as we can into our new row
|
||||||
const copy_len = @minimum(new_row_rem, wrapped_cells_rem);
|
const copy_len = @min(new_row_rem, wrapped_cells_rem);
|
||||||
|
|
||||||
// The row doesn't fit, meaning we have to soft-wrap the
|
// The row doesn't fit, meaning we have to soft-wrap the
|
||||||
// new row but probably at a diff boundary.
|
// new row but probably at a diff boundary.
|
||||||
@ -1436,7 +1436,7 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
errdefer self.* = old;
|
errdefer self.* = old;
|
||||||
|
|
||||||
// Allocate enough to store our screen plus history.
|
// Allocate enough to store our screen plus history.
|
||||||
const buf_size = (self.rows + @maximum(self.history, self.max_scrollback)) * (cols + 1);
|
const buf_size = (self.rows + @max(self.history, self.max_scrollback)) * (cols + 1);
|
||||||
self.storage = try StorageBuf.init(self.alloc, buf_size);
|
self.storage = try StorageBuf.init(self.alloc, buf_size);
|
||||||
errdefer self.storage.deinit(self.alloc);
|
errdefer self.storage.deinit(self.alloc);
|
||||||
defer old.storage.deinit(self.alloc);
|
defer old.storage.deinit(self.alloc);
|
||||||
@ -1510,7 +1510,7 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
{
|
{
|
||||||
assert(new_cursor == null);
|
assert(new_cursor == null);
|
||||||
new_cursor = .{
|
new_cursor = .{
|
||||||
.x = @minimum(cursor_pos.x, self.cols - 1),
|
.x = @min(cursor_pos.x, self.cols - 1),
|
||||||
.y = self.viewport + y,
|
.y = self.viewport + y,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1528,14 +1528,14 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
// point and set it up.
|
// point and set it up.
|
||||||
if (new_cursor) |pos| {
|
if (new_cursor) |pos| {
|
||||||
const viewport_pos = pos.toViewport(self);
|
const viewport_pos = pos.toViewport(self);
|
||||||
self.cursor.x = @minimum(viewport_pos.x, self.cols - 1);
|
self.cursor.x = @min(viewport_pos.x, self.cols - 1);
|
||||||
self.cursor.y = @minimum(viewport_pos.y, self.rows - 1);
|
self.cursor.y = @min(viewport_pos.y, self.rows - 1);
|
||||||
} else {
|
} else {
|
||||||
// TODO: why is this necessary? Without this, neovim will
|
// TODO: why is this necessary? Without this, neovim will
|
||||||
// crash when we shrink the window to the smallest size. We
|
// crash when we shrink the window to the smallest size. We
|
||||||
// never got a test case to cover this.
|
// never got a test case to cover this.
|
||||||
self.cursor.x = @minimum(self.cursor.x, self.cols - 1);
|
self.cursor.x = @min(self.cursor.x, self.cols - 1);
|
||||||
self.cursor.y = @minimum(self.cursor.y, self.rows - 1);
|
self.cursor.y = @min(self.cursor.y, self.rows - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1680,7 +1680,7 @@ pub fn testWriteString(self: *Screen, text: []const u8) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// So the cursor doesn't go off screen
|
// So the cursor doesn't go off screen
|
||||||
self.cursor.x = @minimum(x, self.cols - 1);
|
self.cursor.x = @min(x, self.cols - 1);
|
||||||
self.cursor.y = y;
|
self.cursor.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ pub fn index(self: *Terminal) !void {
|
|||||||
if (self.screen.cursor.y < self.scrolling_region.top or
|
if (self.screen.cursor.y < self.scrolling_region.top or
|
||||||
self.screen.cursor.y > self.scrolling_region.bottom)
|
self.screen.cursor.y > self.scrolling_region.bottom)
|
||||||
{
|
{
|
||||||
self.screen.cursor.y = @minimum(self.screen.cursor.y + 1, self.rows - 1);
|
self.screen.cursor.y = @min(self.screen.cursor.y + 1, self.rows - 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ pub fn index(self: *Terminal) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Increase cursor by 1, maximum to bottom of scroll region
|
// Increase cursor by 1, maximum to bottom of scroll region
|
||||||
self.screen.cursor.y = @minimum(self.screen.cursor.y + 1, self.scrolling_region.bottom);
|
self.screen.cursor.y = @min(self.screen.cursor.y + 1, self.scrolling_region.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Move the cursor to the previous line in the scrolling region, possibly
|
/// Move the cursor to the previous line in the scrolling region, possibly
|
||||||
@ -796,8 +796,8 @@ pub fn setCursorPos(self: *Terminal, row_req: usize, col_req: usize) void {
|
|||||||
|
|
||||||
const row = if (row_req == 0) 1 else row_req;
|
const row = if (row_req == 0) 1 else row_req;
|
||||||
const col = if (col_req == 0) 1 else col_req;
|
const col = if (col_req == 0) 1 else col_req;
|
||||||
self.screen.cursor.x = @minimum(params.x_max, col) -| 1;
|
self.screen.cursor.x = @min(params.x_max, col) -| 1;
|
||||||
self.screen.cursor.y = @minimum(params.y_max, row + params.y_offset) -| 1;
|
self.screen.cursor.y = @min(params.y_max, row + params.y_offset) -| 1;
|
||||||
// log.info("set cursor position: col={} row={}", .{ self.screen.cursor.x, self.screen.cursor.y });
|
// log.info("set cursor position: col={} row={}", .{ self.screen.cursor.x, self.screen.cursor.y });
|
||||||
|
|
||||||
// Unset pending wrap state
|
// Unset pending wrap state
|
||||||
@ -821,7 +821,7 @@ pub fn setCursorColAbsolute(self: *Terminal, col_req: usize) void {
|
|||||||
if (self.status_display != .main) return; // TODO
|
if (self.status_display != .main) return; // TODO
|
||||||
|
|
||||||
const col = if (col_req == 0) 1 else col_req;
|
const col = if (col_req == 0) 1 else col_req;
|
||||||
self.screen.cursor.x = @minimum(self.cols, col) - 1;
|
self.screen.cursor.x = @min(self.cols, col) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Erase the display.
|
/// Erase the display.
|
||||||
@ -966,7 +966,7 @@ pub fn eraseChars(self: *Terminal, count: usize) void {
|
|||||||
|
|
||||||
// Our last index is at most the end of the number of chars we have
|
// Our last index is at most the end of the number of chars we have
|
||||||
// in the current line.
|
// in the current line.
|
||||||
const end = @minimum(self.cols, self.screen.cursor.x + count);
|
const end = @min(self.cols, self.screen.cursor.x + count);
|
||||||
|
|
||||||
// Shift
|
// Shift
|
||||||
var pen = self.screen.cursor.pen;
|
var pen = self.screen.cursor.pen;
|
||||||
@ -1169,7 +1169,7 @@ pub fn insertLines(self: *Terminal, count: usize) !void {
|
|||||||
const rem = self.scrolling_region.bottom - self.screen.cursor.y + 1;
|
const rem = self.scrolling_region.bottom - self.screen.cursor.y + 1;
|
||||||
|
|
||||||
// If count is greater than the amount of rows, adjust down.
|
// If count is greater than the amount of rows, adjust down.
|
||||||
const adjusted_count = @minimum(count, rem);
|
const adjusted_count = @min(count, rem);
|
||||||
|
|
||||||
// The the top `scroll_amount` lines need to move to the bottom
|
// The the top `scroll_amount` lines need to move to the bottom
|
||||||
// scroll area. We may have nothing to scroll if we're clearing.
|
// scroll area. We may have nothing to scroll if we're clearing.
|
||||||
@ -1219,7 +1219,7 @@ pub fn deleteLines(self: *Terminal, count: usize) !void {
|
|||||||
const rem = self.scrolling_region.bottom - self.screen.cursor.y + 1;
|
const rem = self.scrolling_region.bottom - self.screen.cursor.y + 1;
|
||||||
|
|
||||||
// If the count is more than our remaining lines, we adjust down.
|
// If the count is more than our remaining lines, we adjust down.
|
||||||
const adjusted_count = @minimum(count, rem);
|
const adjusted_count = @min(count, rem);
|
||||||
|
|
||||||
// Scroll up the count amount.
|
// Scroll up the count amount.
|
||||||
var y: usize = self.screen.cursor.y;
|
var y: usize = self.screen.cursor.y;
|
||||||
@ -1306,7 +1306,7 @@ pub fn setScrollingRegion(self: *Terminal, top: usize, bottom: usize) void {
|
|||||||
defer tracy.end();
|
defer tracy.end();
|
||||||
|
|
||||||
var t = if (top == 0) 1 else top;
|
var t = if (top == 0) 1 else top;
|
||||||
var b = @minimum(bottom, self.rows);
|
var b = @min(bottom, self.rows);
|
||||||
if (t >= b) {
|
if (t >= b) {
|
||||||
t = 1;
|
t = 1;
|
||||||
b = self.rows;
|
b = self.rows;
|
||||||
|
@ -120,7 +120,7 @@ pub fn CircBuf(comptime T: type, comptime default: T) type {
|
|||||||
|
|
||||||
// If we're not full, we can just advance the tail. We know
|
// If we're not full, we can just advance the tail. We know
|
||||||
// it'll be less than the length because otherwise we'd be full.
|
// it'll be less than the length because otherwise we'd be full.
|
||||||
self.tail += @minimum(self.len(), n);
|
self.tail += @min(self.len(), n);
|
||||||
if (self.tail >= self.storage.len) self.tail -= self.storage.len;
|
if (self.tail >= self.storage.len) self.tail -= self.storage.len;
|
||||||
self.full = false;
|
self.full = false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user