Make undo/redo app-targeted so it works with no windows
parent
5507ec0fc0
commit
3b77a16b63
|
|
@ -446,6 +446,9 @@ pub fn performAction(
|
|||
.toggle_visibility => _ = try rt_app.performAction(.app, .toggle_visibility, {}),
|
||||
.check_for_updates => _ = try rt_app.performAction(.app, .check_for_updates, {}),
|
||||
.show_gtk_inspector => _ = try rt_app.performAction(.app, .show_gtk_inspector, {}),
|
||||
.undo => _ = try rt_app.performAction(.app, .undo, {}),
|
||||
|
||||
.redo => _ = try rt_app.performAction(.app, .redo, {}),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3923,6 +3923,21 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||
.{ .parent = self },
|
||||
),
|
||||
|
||||
// Undo and redo both support both surface and app targeting.
|
||||
// If we are triggering on a surface then we perform the
|
||||
// action with the surface target.
|
||||
.undo => return try self.rt_app.performAction(
|
||||
.{ .surface = self },
|
||||
.undo,
|
||||
{},
|
||||
),
|
||||
|
||||
.redo => return try self.rt_app.performAction(
|
||||
.{ .surface = self },
|
||||
.redo,
|
||||
{},
|
||||
),
|
||||
|
||||
else => try self.app.performAction(
|
||||
self.rt_app,
|
||||
action.scoped(.app).?,
|
||||
|
|
@ -4337,18 +4352,6 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||
{},
|
||||
),
|
||||
|
||||
.undo => return try self.rt_app.performAction(
|
||||
.{ .surface = self },
|
||||
.undo,
|
||||
{},
|
||||
),
|
||||
|
||||
.redo => return try self.rt_app.performAction(
|
||||
.{ .surface = self },
|
||||
.redo,
|
||||
{},
|
||||
),
|
||||
|
||||
.select_all => {
|
||||
const sel = self.io.terminal.screen.selectAll();
|
||||
if (sel) |s| {
|
||||
|
|
|
|||
|
|
@ -980,6 +980,8 @@ pub const Action = union(enum) {
|
|||
|
||||
// These are app but can be special-cased in a surface context.
|
||||
.new_window,
|
||||
.undo,
|
||||
.redo,
|
||||
=> .app,
|
||||
|
||||
// Obviously surface actions.
|
||||
|
|
@ -1020,8 +1022,6 @@ pub const Action = union(enum) {
|
|||
.toggle_secure_input,
|
||||
.toggle_command_palette,
|
||||
.reset_window_size,
|
||||
.undo,
|
||||
.redo,
|
||||
.crash,
|
||||
=> .surface,
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue