mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
scrollback: buffer writes to scrollback file
Screen.dumpString writes one character at a time, so buffer writes to the scrollback file to speed it up.
This commit is contained in:
@ -3201,6 +3201,8 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||||||
// Open our scrollback file
|
// Open our scrollback file
|
||||||
var file = try tmp_dir.dir.createFile("scrollback", .{});
|
var file = try tmp_dir.dir.createFile("scrollback", .{});
|
||||||
defer file.close();
|
defer file.close();
|
||||||
|
// Screen.dumpString writes byte-by-byte, so buffer it
|
||||||
|
var buf_writer = std.io.bufferedWriter(file.writer());
|
||||||
|
|
||||||
// Write the scrollback contents. This requires a lock.
|
// Write the scrollback contents. This requires a lock.
|
||||||
{
|
{
|
||||||
@ -3221,11 +3223,12 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||||||
if (pages.getBottomRight(.active)) |br| {
|
if (pages.getBottomRight(.active)) |br| {
|
||||||
const tl = pages.getTopLeft(.history);
|
const tl = pages.getTopLeft(.history);
|
||||||
try self.io.terminal.screen.dumpString(
|
try self.io.terminal.screen.dumpString(
|
||||||
file.writer(),
|
buf_writer.writer(),
|
||||||
.{ .tl = tl, .br = br, .unwrap = true },
|
.{ .tl = tl, .br = br, .unwrap = true },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try buf_writer.flush();
|
||||||
|
|
||||||
// Get the final path
|
// Get the final path
|
||||||
var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||||
|
Reference in New Issue
Block a user