fix: editor paste

This commit is contained in:
CJ van den Berg 2024-11-22 13:43:15 +01:00
parent 279789d4fa
commit a9e5c5b262
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
6 changed files with 14 additions and 12 deletions

View file

@ -333,10 +333,10 @@ pub fn Create(options: type) type {
} }
pub const mini_mode_select_meta = .{ .description = "Select" }; pub const mini_mode_select_meta = .{ .description = "Select" };
pub fn paste(self: *Self, ctx: Ctx) Result { pub fn mini_mode_paste(self: *Self, ctx: Ctx) Result {
return mini_mode_insert_bytes(self, ctx); return mini_mode_insert_bytes(self, ctx);
} }
pub const paste_meta = .{ .arguments = &.{.string} }; pub const mini_mode_paste_meta = .{ .arguments = &.{.string} };
}; };
}; };
} }

View file

@ -215,8 +215,8 @@ const cmds = struct {
} }
pub const mini_mode_history_next_meta = .{ .description = "History next" }; pub const mini_mode_history_next_meta = .{ .description = "History next" };
pub fn paste(self: *Self, ctx: Ctx) Result { pub fn mini_mode_paste(self: *Self, ctx: Ctx) Result {
return mini_mode_insert_bytes(self, ctx); return mini_mode_insert_bytes(self, ctx);
} }
pub const paste_meta = .{ .arguments = &.{.string} }; pub const mini_mode_paste_meta = .{ .arguments = &.{.string} };
}; };

View file

@ -153,8 +153,8 @@ const cmds = struct {
} }
pub const mini_mode_delete_backwards_meta = .{ .description = "Delete backwards" }; pub const mini_mode_delete_backwards_meta = .{ .description = "Delete backwards" };
pub fn paste(self: *Self, ctx: Ctx) Result { pub fn mini_mode_paste(self: *Self, ctx: Ctx) Result {
return mini_mode_insert_bytes(self, ctx); return mini_mode_insert_bytes(self, ctx);
} }
pub const paste_meta = .{ .arguments = &.{.string} }; pub const mini_mode_paste_meta = .{ .arguments = &.{.string} };
}; };

View file

@ -340,8 +340,8 @@ const cmds = struct {
} }
pub const overlay_toggle_inputview_meta = .{}; pub const overlay_toggle_inputview_meta = .{};
pub fn paste(self: *Self, ctx: Ctx) Result { pub fn mini_mode_paste(self: *Self, ctx: Ctx) Result {
return overlay_insert_bytes(self, ctx); return overlay_insert_bytes(self, ctx);
} }
pub const paste_meta = .{ .arguments = &.{.string} }; pub const mini_mode_paste_meta = .{ .arguments = &.{.string} };
}; };

View file

@ -465,10 +465,10 @@ pub fn Create(options: type) type {
} }
pub const overlay_toggle_inputview_meta = .{}; pub const overlay_toggle_inputview_meta = .{};
pub fn paste(self: *Self, ctx: Ctx) Result { pub fn mini_mode_paste(self: *Self, ctx: Ctx) Result {
return overlay_insert_bytes(self, ctx); return overlay_insert_bytes(self, ctx);
} }
pub const paste_meta = .{ .arguments = &.{.string} }; pub const mini_mode_paste_meta = .{ .arguments = &.{.string} };
}; };
}; };
} }

View file

@ -285,8 +285,10 @@ fn receive_safe(self: *Self, from: tp.pid_ref, m: tp.message) !void {
if (try m.match(.{ "system_clipboard", tp.extract(&text) })) { if (try m.match(.{ "system_clipboard", tp.extract(&text) })) {
try self.dispatch_flush_input_event(); try self.dispatch_flush_input_event();
try command.executeName("paste", command.fmt(.{text})); return if (command.get_id("mini_mode_paste")) |id|
return; command.execute(id, .{})
else
command.executeName("paste", command.fmt(.{text}));
} }
if (try m.match(.{"render"})) { if (try m.match(.{"render"})) {