fix: paste command

This commit is contained in:
CJ van den Berg 2024-11-22 11:12:34 +01:00
parent 73b7031693
commit 0f509df2d4
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 3 additions and 8 deletions

View file

@ -369,7 +369,6 @@ const BindingSet = struct {
var keypress: input.Key = 0; var keypress: input.Key = 0;
var egc: input.Key = 0; var egc: input.Key = 0;
var modifiers: input.Mods = 0; var modifiers: input.Mods = 0;
var text: []const u8 = "";
if (try m.match(.{ if (try m.match(.{
"I", "I",
@ -388,10 +387,6 @@ const BindingSet = struct {
} }
} else if (try m.match(.{"F"})) { } else if (try m.match(.{"F"})) {
self.flush() catch |e| return tp.exit_error(e, @errorReturnTrace()); self.flush() catch |e| return tp.exit_error(e, @errorReturnTrace());
} else if (try m.match(.{ "system_clipboard", tp.extract(&text) })) {
self.flush() catch |e| return tp.exit_error(e, @errorReturnTrace());
self.insert_bytes(text) catch |e| return tp.exit_error(e, @errorReturnTrace());
self.flush() catch |e| return tp.exit_error(e, @errorReturnTrace());
} }
return false; return false;
} }

View file

@ -283,9 +283,9 @@ fn receive_safe(self: *Self, from: tp.pid_ref, m: tp.message) !void {
return; return;
} }
if (try m.match(.{ "system_clipboard", tp.string })) { if (try m.match(.{ "system_clipboard", tp.extract(&text) })) {
if (self.active_event_handler()) |eh| try self.dispatch_flush_input_event();
eh.send(tp.self_pid(), m) catch |e| self.logger.err("clipboard handler", e); try command.executeName("paste", command.fmt(.{text}));
return; return;
} }