diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 4ae0922..72e9955 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -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); diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index 664f5f8..8f0d734 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -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 {