mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Action that writes both scrollback and active screen to file.
Currently, you can write the scrollback to a file, write the active screen to a file, but not both. This adds an action that writes both to a file.
This commit is contained in:
@ -3337,6 +3337,11 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||||||
}, .unlocked);
|
}, .unlocked);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.write_all_file => |v| try self.writeScreenFile(
|
||||||
|
.all,
|
||||||
|
v,
|
||||||
|
),
|
||||||
|
|
||||||
.write_screen_file => |v| try self.writeScreenFile(
|
.write_screen_file => |v| try self.writeScreenFile(
|
||||||
.screen,
|
.screen,
|
||||||
v,
|
v,
|
||||||
@ -3537,6 +3542,7 @@ 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 {
|
||||||
|
all, // Full screen and history (scrollback)
|
||||||
screen, // Full screen
|
screen, // Full screen
|
||||||
history, // History (scrollback)
|
history, // History (scrollback)
|
||||||
selection, // Selected text
|
selection, // Selected text
|
||||||
@ -3591,6 +3597,14 @@ fn writeScreenFile(
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.all => all: {
|
||||||
|
break :all terminal.Selection.init(
|
||||||
|
pages.getTopLeft(.history),
|
||||||
|
pages.getBottomRight(.screen) orelse break :all null,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
.selection => self.io.terminal.screen.selection,
|
.selection => self.io.terminal.screen.selection,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,22 +203,35 @@ pub const Action = union(enum) {
|
|||||||
/// number of prompts to jump forward, negative is backwards.
|
/// number of prompts to jump forward, negative is backwards.
|
||||||
jump_to_prompt: i16,
|
jump_to_prompt: i16,
|
||||||
|
|
||||||
/// Write the entire scrollback into a temporary file. The action
|
/// Write the entire scrollback _and_ the active screen into a temporary
|
||||||
/// determines what to do with the filepath. Valid values are:
|
/// file. The action determines what to do with the filepath. Valid values
|
||||||
|
/// are:
|
||||||
///
|
///
|
||||||
/// - "paste": Paste the file path into the terminal.
|
/// - "paste": Paste the file path into the terminal.
|
||||||
/// - "open": Open the file in the default OS editor for text files.
|
/// - "open": Open the file in the default OS editor for text files.
|
||||||
|
write_all_file: WriteScreenAction,
|
||||||
|
|
||||||
|
/// Write the entire scrollback into a temporary file. Note that this does
|
||||||
|
/// not include the contents of the active screen. 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,
|
write_scrollback_file: WriteScreenAction,
|
||||||
|
|
||||||
/// Same as write_scrollback_file but writes the full screen contents.
|
/// Write the active screen into a temporary file. The action determines
|
||||||
/// See write_scrollback_file for available values.
|
/// 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_screen_file: WriteScreenAction,
|
write_screen_file: WriteScreenAction,
|
||||||
|
|
||||||
/// Same as write_scrollback_file but writes the selected text.
|
/// Write the selected text into a temporary file. If there is no selected
|
||||||
/// If there is no selected text this does nothing (it doesn't
|
/// text this does nothing (it doesn't even create an empty file). The
|
||||||
/// even create an empty file). See write_scrollback_file for
|
/// action determines what to do with the filepath. Valid values are:
|
||||||
/// available values.
|
///
|
||||||
|
/// - "paste": Paste the file path into the terminal.
|
||||||
|
/// - "open": Open the file in the default OS editor for text files.
|
||||||
write_selection_file: WriteScreenAction,
|
write_selection_file: WriteScreenAction,
|
||||||
|
|
||||||
/// Open a new window.
|
/// Open a new window.
|
||||||
|
Reference in New Issue
Block a user