This commit is contained in:
Mitchell Hashimoto
2023-11-17 21:37:37 -08:00
parent e3b83249d6
commit cb0cfab438
2 changed files with 5 additions and 2 deletions

View File

@ -152,6 +152,9 @@ pub const Action = union(enum) {
/// Clear the screen. This also clears all scrollback. /// Clear the screen. This also clears all scrollback.
clear_screen: void, clear_screen: void,
/// Select all text on the screen.
select_all: void,
/// Scroll the screen varying amounts. /// Scroll the screen varying amounts.
scroll_to_top: void, scroll_to_top: void,
scroll_to_bottom: void, scroll_to_bottom: void,
@ -223,8 +226,6 @@ pub const Action = union(enum) {
/// Quit ghostty /// Quit ghostty
quit: void, quit: void,
select_all: void,
pub const CursorKey = struct { pub const CursorKey = struct {
normal: []const u8, normal: []const u8,
application: []const u8, application: []const u8,

View File

@ -1392,6 +1392,8 @@ pub fn clear(self: *Screen, mode: ClearMode) !void {
} }
} }
/// Return the selection for all contents on the screen. Surrounding
/// whitespace is omitted. If there is no selection, this returns null.
pub fn selectAll(self: *Screen) ?Selection { pub fn selectAll(self: *Screen) ?Selection {
const whitespace = &[_]u32{ 0, ' ', '\t' }; const whitespace = &[_]u32{ 0, ' ', '\t' };
const y_max = self.rowsWritten() - 1; const y_max = self.rowsWritten() - 1;