| ... | @@ -48,8 +48,9 @@ timer: ?time.Timer = null, | ... | @@ -48,8 +48,9 @@ timer: ?time.Timer = null, |
| 48 | /// Used to compare with `refresh_rate_ms`. | 48 | /// Used to compare with `refresh_rate_ms`. |
| 49 | prev_refresh_timestamp: u64 = undefined, | 49 | prev_refresh_timestamp: u64 = undefined, |
| 50 | | 50 | |
| 51 | /// This buffer represents the maximum number of bytes written to the terminal | 51 | /// This is the maximum number of bytes that can be written to the terminal each refresh. |
| 52 | /// with each refresh. | 52 | /// Anything larger than this is truncated. |
| | 53 | // we can bump this up if we need to |
| 53 | output_buffer: [256]u8 = undefined, | 54 | output_buffer: [256]u8 = undefined, |
| 54 | output_buffer_slice: []u8 = undefined, | 55 | output_buffer_slice: []u8 = undefined, |
| 55 | | 56 | |
| ... | @@ -247,7 +248,7 @@ fn getTerminalCursorColumn(self: Progress, file: std.fs.File) !u16 { | ... | @@ -247,7 +248,7 @@ fn getTerminalCursorColumn(self: Progress, file: std.fs.File) !u16 { |
| 247 | }; | 248 | }; |
| 248 | | 249 | |
| 249 | try file.writeAll("\x1b[6n"); | 250 | try file.writeAll("\x1b[6n"); |
| 250 | var buf: ["\x1b[256;256R".len]u8 = undefined; | 251 | var buf: ["\x1b[65536;65536R".len]u8 = undefined; |
| 251 | const output = try file.reader().readUntilDelimiter(&buf, 'R'); | 252 | const output = try file.reader().readUntilDelimiter(&buf, 'R'); |
| 252 | var splitter = std.mem.split(u8, output, ";"); | 253 | var splitter = std.mem.split(u8, output, ";"); |
| 253 | _ = splitter.next().?; // skip first half | 254 | _ = splitter.next().?; // skip first half |
| ... | @@ -356,7 +357,7 @@ fn refreshWithHeldLock(self: *Progress) void { | ... | @@ -356,7 +357,7 @@ fn refreshWithHeldLock(self: *Progress) void { |
| 356 | // we possibly wrote previously don't affect whether we truncate the line in `bufWrite`. | 357 | // we possibly wrote previously don't affect whether we truncate the line in `bufWrite`. |
| 357 | const unprintables = end; | 358 | const unprintables = end; |
| 358 | end = 0; | 359 | end = 0; |
| 359 | self.output_buffer_slice = self.output_buffer[unprintables .. unprintables + self.max_width.?]; | 360 | self.output_buffer_slice = self.output_buffer[unprintables..@minimum(self.output_buffer.len, unprintables + self.max_width.?)]; |
| 360 | | 361 | |
| 361 | if (!self.done) { | 362 | if (!self.done) { |
| 362 | var need_ellipsis = false; | 363 | var need_ellipsis = false; |