mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-01-06 21:37:49 +00:00
some bikeshedding
This commit is contained in:
@@ -3324,7 +3324,7 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
||||
}, .unlocked);
|
||||
},
|
||||
|
||||
.write_scrollback_file => |scrollback_action| write_scrollback_file: {
|
||||
.write_scrollback_file => |write_action| write_scrollback_file: {
|
||||
// Create a temporary directory to store our scrollback.
|
||||
var tmp_dir = try internal_os.TempDir.init();
|
||||
errdefer tmp_dir.deinit();
|
||||
@@ -3365,17 +3365,12 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
||||
var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
const path = try tmp_dir.dir.realpath("scrollback", &path_buf);
|
||||
|
||||
switch (scrollback_action) {
|
||||
.paste => {
|
||||
self.io.queueMessage(try termio.Message.writeReq(
|
||||
self.alloc,
|
||||
path,
|
||||
), .unlocked);
|
||||
},
|
||||
.open => {
|
||||
log.debug("opening scrollback file: {s}", .{path});
|
||||
try internal_os.open(self.alloc, path);
|
||||
},
|
||||
switch (write_action) {
|
||||
.open => try internal_os.open(self.alloc, path),
|
||||
.paste => self.io.queueMessage(try termio.Message.writeReq(
|
||||
self.alloc,
|
||||
path,
|
||||
), .unlocked),
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -203,9 +203,13 @@ pub const Action = union(enum) {
|
||||
/// number of prompts to jump forward, negative is backwards.
|
||||
jump_to_prompt: i16,
|
||||
|
||||
/// Write the entire scrollback into a temporary file and write the path to
|
||||
/// the file to the tty.
|
||||
write_scrollback_file: WriteScrollbackAction,
|
||||
/// Write the entire scrollback into a temporary file. The action
|
||||
/// determines what to do with the filepath. Valid values are:
|
||||
///
|
||||
/// - "paste": Paste the file path into the terminal.
|
||||
/// - "open": Open the file in the default OS editor for text files.
|
||||
///
|
||||
write_scrollback_file: WriteScreenAction,
|
||||
|
||||
/// Open a new window.
|
||||
new_window: void,
|
||||
@@ -292,11 +296,6 @@ pub const Action = union(enum) {
|
||||
end,
|
||||
};
|
||||
|
||||
pub const WriteScrollbackAction = enum {
|
||||
paste,
|
||||
open,
|
||||
};
|
||||
|
||||
pub const SplitDirection = enum {
|
||||
right,
|
||||
down,
|
||||
@@ -329,6 +328,11 @@ pub const Action = union(enum) {
|
||||
u16,
|
||||
};
|
||||
|
||||
pub const WriteScreenAction = enum {
|
||||
paste,
|
||||
open,
|
||||
};
|
||||
|
||||
// Extern because it is used in the embedded runtime ABI.
|
||||
pub const InspectorMode = enum(c_int) {
|
||||
toggle,
|
||||
|
||||
Reference in New Issue
Block a user