Introduce reset_window_size keybinding and apprt action

Related to #6035

This implements the keybind/action portion of #5974 so that this can
have a binding and so that other apprts can respond to this and
implement it this way.
This commit is contained in:
Mitchell Hashimoto
2025-02-28 15:25:14 -08:00
parent c6485b9fd5
commit 17cae57f51
11 changed files with 65 additions and 2 deletions

View File

@@ -4228,6 +4228,12 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
{},
),
.reset_window_size => return try self.rt_app.performAction(
.{ .surface = self },
.reset_window_size,
{},
),
.toggle_maximize => return try self.rt_app.performAction(
.{ .surface = self },
.toggle_maximize,

View File

@@ -140,6 +140,10 @@ pub const Action = union(Key) {
/// Sets a size limit (in pixels) for the target terminal.
size_limit: SizeLimit,
/// Resets the window size to the default size. See the
/// `reset_window_size` keybinding for more information.
reset_window_size,
/// Specifies the initial size of the target terminal.
///
/// This may be sent once during the initialization of a surface
@@ -259,6 +263,7 @@ pub const Action = union(Key) {
toggle_split_zoom,
present_terminal,
size_limit,
reset_window_size,
initial_size,
cell_size,
inspector,

View File

@@ -240,6 +240,7 @@ pub const App = struct {
.config_change,
.toggle_maximize,
.prompt_title,
.reset_window_size,
=> {
log.info("unimplemented action={}", .{action});
return false;

View File

@@ -512,6 +512,7 @@ pub fn performAction(
.render_inspector,
.renderer_health,
.color_change,
.reset_window_size,
=> {
log.warn("unimplemented action={}", .{action});
return false;

View File

@@ -380,6 +380,11 @@ pub const Action = union(enum) {
/// Equalize all splits in the current window
equalize_splits: void,
/// Reset the window to the default size. The "default size" is the
/// size that a new window would be created with. This has no effect
/// if the window is fullscreen.
reset_window_size: void,
/// Control the terminal inspector visibility.
///
/// Arguments:
@@ -772,6 +777,7 @@ pub const Action = union(enum) {
.toggle_fullscreen,
.toggle_window_decorations,
.toggle_secure_input,
.reset_window_size,
.crash,
=> .surface,