From 348287c620819f96ebef8360458ff9fc9df5e968 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sun, 27 Oct 2024 15:58:51 -0500 Subject: [PATCH] core: add a .txt extenstion to scrollback file This should make it easier for open or xdg-open to find an appropriate application to open the scrollback file with. --- src/Surface.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index b984ea997..82d1240eb 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -4118,9 +4118,13 @@ fn writeScreenFile( var tmp_dir = try internal_os.TempDir.init(); errdefer tmp_dir.deinit(); + var filename_buf: [std.fs.max_path_bytes]u8 = undefined; + const filename = try std.fmt.bufPrint(&filename_buf, "{s}.txt", .{@tagName(loc)}); + // Open our scrollback file - var file = try tmp_dir.dir.createFile(@tagName(loc), .{}); + var file = try tmp_dir.dir.createFile(filename, .{}); defer file.close(); + // Screen.dumpString writes byte-by-byte, so buffer it var buf_writer = std.io.bufferedWriter(file.writer()); @@ -4179,7 +4183,7 @@ fn writeScreenFile( // Get the final path var path_buf: [std.fs.max_path_bytes]u8 = undefined; - const path = try tmp_dir.dir.realpath(@tagName(loc), &path_buf); + const path = try tmp_dir.dir.realpath(filename, &path_buf); switch (write_action) { .open => try internal_os.open(self.alloc, path),