fix(Buffer): prevent integer bit truncation crash in files with extremely long lines

This commit is contained in:
CJ van den Berg 2024-07-02 12:43:52 +02:00
parent 5164164fd7
commit 581dbfb749
2 changed files with 5 additions and 5 deletions

View file

@ -3856,7 +3856,7 @@ pub const EditorWidget = struct {
};
pub const PosToWidthCache = struct {
cache: std.ArrayList(u16),
cache: std.ArrayList(usize),
cached_line: usize = std.math.maxInt(usize),
cached_root: ?Buffer.Root = null,
@ -3864,7 +3864,7 @@ pub const PosToWidthCache = struct {
pub fn init(a: Allocator) !Self {
return .{
.cache = try std.ArrayList(u16).initCapacity(a, 2048),
.cache = try std.ArrayList(usize).initCapacity(a, 2048),
};
}