Cleanup code and optimize message

This commit is contained in:
Ethan Conneely
2024-12-30 23:21:28 +00:00
parent 00041d0e64
commit e832173d13

View File

@ -3878,16 +3878,19 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
.copy_or_interrupt => { .copy_or_interrupt => {
if (copyToClipboard(self)) { if (copyToClipboard(self)) {
return true; return true;
} else { }
const buf = try self.alloc.alloc(u8, 1);
defer self.alloc.free(buf);
buf[0] = 3; const SigInterrupt = 0x3;
self.io.queueMessage(try termio.Message.writeReq( var data: termio.Message.WriteReq.Small.Array = undefined;
self.alloc, data[0] = SigInterrupt;
buf,
), .unlocked); self.io.queueMessage(.{
.write_small = .{
.data = data,
.len = 1,
},
}, .unlocked);
// Text triggers a scroll. // Text triggers a scroll.
{ {
@ -3897,9 +3900,6 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
log.warn("error scrolling to bottom err={}", .{err}); log.warn("error scrolling to bottom err={}", .{err});
}; };
} }
return true;
}
}, },
.paste_from_clipboard => try self.startClipboardRequest( .paste_from_clipboard => try self.startClipboardRequest(