From 74d9996eb86e5c7931db4bcdeead598d64d3d21d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 24 Oct 2023 22:26:39 -0700 Subject: [PATCH] inspector: always increment seq number for vt events --- src/inspector/termio.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/inspector/termio.zig b/src/inspector/termio.zig index 8b6665109..ced2659dc 100644 --- a/src/inspector/termio.zig +++ b/src/inspector/termio.zig @@ -111,6 +111,11 @@ pub const VTHandler = struct { pub fn handleManually(self: *VTHandler, action: terminal.Parser.Action) !bool { const insp = self.surface.inspector orelse return false; + // We always increment the sequence number, even if we're paused or + // filter out the event. This helps show the user that there is a gap + // between events and roughly how large that gap was. + defer self.current_seq +%= 1; + // If we're pausing, then we ignore all events. if (!self.active) return true; @@ -128,12 +133,10 @@ pub const VTHandler = struct { const alloc = self.surface.alloc; var ev = try VTEvent.init(alloc, self.surface, action); ev.seq = self.current_seq; - self.current_seq +%= 1; errdefer ev.deinit(alloc); // Check if the event passes the filter if (!ev.passFilter(self.filter_text)) { - self.current_seq -= 1; ev.deinit(alloc); return true; }