fix(vaxis): prevent a crash on large bracketed paste operations

Now we just serialize *all* event data and drop the grapheme cache
that was overflowing.
This commit is contained in:
CJ van den Berg 2024-06-19 17:39:27 +02:00
parent 0dd9cb179e
commit 866451779b
2 changed files with 19 additions and 17 deletions

View file

@ -179,8 +179,9 @@ fn receive(self: *Self, from: tp.pid_ref, m: tp.message) tp.result {
fn receive_safe(self: *Self, from: tp.pid_ref, m: tp.message) tp.result {
var input: []const u8 = undefined;
if (try m.match(.{ "VXS", tp.extract(&input) })) {
self.rdr.process_input_event(input) catch |e| return tp.exit_error(e);
var text: []const u8 = undefined;
if (try m.match(.{ "VXS", tp.extract(&input), tp.extract(&text) })) {
self.rdr.process_input_event(input, if (text.len > 0) text else null) catch |e| return tp.exit_error(e);
try self.dispatch_flush_input_event();
if (self.unrendered_input_events_count > 0 and !self.frame_clock_running)
need_render();