mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
core: add binding to write screen to file
This commit is contained in:
@ -3324,6 +3324,11 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||||||
}, .unlocked);
|
}, .unlocked);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.write_screen_file => |v| try self.writeScreenFile(
|
||||||
|
.screen,
|
||||||
|
v,
|
||||||
|
),
|
||||||
|
|
||||||
.write_scrollback_file => |v| try self.writeScreenFile(
|
.write_scrollback_file => |v| try self.writeScreenFile(
|
||||||
.history,
|
.history,
|
||||||
v,
|
v,
|
||||||
@ -3512,8 +3517,9 @@ fn closingAction(action: input.Binding.Action) bool {
|
|||||||
|
|
||||||
/// The portion of the screen to write for writeScreenFile.
|
/// The portion of the screen to write for writeScreenFile.
|
||||||
const WriteScreenLoc = enum {
|
const WriteScreenLoc = enum {
|
||||||
history,
|
screen, // Full screen
|
||||||
selection,
|
history, // History (scrollback)
|
||||||
|
selection, // Selected text
|
||||||
};
|
};
|
||||||
|
|
||||||
fn writeScreenFile(
|
fn writeScreenFile(
|
||||||
@ -3556,6 +3562,15 @@ fn writeScreenFile(
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.screen => screen: {
|
||||||
|
break :screen terminal.Selection.init(
|
||||||
|
pages.getTopLeft(.screen),
|
||||||
|
pages.getBottomRight(.screen) orelse
|
||||||
|
break :screen null,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
.selection => self.io.terminal.screen.selection,
|
.selection => self.io.terminal.screen.selection,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -211,6 +211,10 @@ pub const Action = union(enum) {
|
|||||||
///
|
///
|
||||||
write_scrollback_file: WriteScreenAction,
|
write_scrollback_file: WriteScreenAction,
|
||||||
|
|
||||||
|
/// Same as write_scrollback_file but writes the full screen contents.
|
||||||
|
/// See write_scrollback_file for available values.
|
||||||
|
write_screen_file: WriteScreenAction,
|
||||||
|
|
||||||
/// Same as write_scrollback_file but writes the selected text.
|
/// Same as write_scrollback_file but writes the selected text.
|
||||||
/// If there is no selected text this does nothing (it doesn't
|
/// If there is no selected text this does nothing (it doesn't
|
||||||
/// even create an empty file). See write_scrollback_file for
|
/// even create an empty file). See write_scrollback_file for
|
||||||
|
Reference in New Issue
Block a user