fix: move system_paste command to mainview so it can be used when on editor is open

This commit is contained in:
CJ van den Berg 2024-11-17 22:01:10 +01:00
parent e69960c6d4
commit ed843a9baf
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 8 additions and 6 deletions

View file

@ -2098,12 +2098,6 @@ pub const Editor = struct {
}
pub const paste_meta = .{ .description = "Paste from internal clipboard" };
pub fn system_paste(self: *Self, _: Context) Result {
if (builtin.os.tag == .windows) return self.paste(.{});
tui.current().rdr.request_system_clipboard();
}
pub const system_paste_meta = .{ .description = "Paste from system clipboard" };
pub fn delete_forward(self: *Self, _: Context) Result {
const b = try self.buf_for_update();
const root = try self.delete_to(move_cursor_right, b.root, b.allocator);

View file

@ -7,6 +7,7 @@ const root = @import("root");
const location_history = @import("location_history");
const project_manager = @import("project_manager");
const log = @import("log");
const builtin = @import("builtin");
const Plane = @import("renderer").Plane;
const input = @import("input");
@ -543,6 +544,13 @@ const cmds = struct {
self.show_file_async_and_free(file_path orelse return error.Stop);
}
pub const open_previous_file_meta = .{ .description = "Open the previous file" };
pub fn system_paste(_: *Self, _: Ctx) Result {
if (builtin.os.tag == .windows)
return command.executeName("paste", .{}) catch {};
tui.current().rdr.request_system_clipboard();
}
pub const system_paste_meta = .{ .description = "Paste from system clipboard" };
};
pub fn handle_editor_event(self: *Self, _: tp.pid_ref, m: tp.message) tp.result {