mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-17 21:12:39 +00:00
terminal: stream handleManually => vtRaw
This commit is contained in:
@@ -693,7 +693,7 @@ const VTHandler = struct {
|
||||
}
|
||||
|
||||
/// This is called with every single terminal action.
|
||||
pub fn handleManually(self: *VTHandler, action: terminal.Parser.Action) !bool {
|
||||
pub fn vtRaw(self: *VTHandler, action: terminal.Parser.Action) !bool {
|
||||
const state: *State = if (self.state) |*s| s else return true;
|
||||
const alloc = state.alloc;
|
||||
const vt_events = state.events;
|
||||
@@ -748,7 +748,9 @@ const VTHandler = struct {
|
||||
else => return err,
|
||||
};
|
||||
|
||||
return true;
|
||||
// Do NOT skip it, because we want to record more information
|
||||
// about this event.
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -707,19 +707,21 @@ pub fn Stream(comptime Handler: type) type {
|
||||
const action = action_opt orelse continue;
|
||||
if (comptime debug) log.info("action: {f}", .{action});
|
||||
|
||||
// If this handler handles everything manually then we do nothing
|
||||
// if it can be processed.
|
||||
if (@hasDecl(T, "handleManually")) {
|
||||
const processed = self.handler.handleManually(action) catch |err| err: {
|
||||
// A handler can expose this to get the raw action before
|
||||
// it is further parsed. If this returns `true` then we skip
|
||||
// processing ourselves.
|
||||
if (@hasDecl(T, "vtRaw")) {
|
||||
const skip = self.handler.vtRaw(action) catch |err| err: {
|
||||
log.warn("error handling action manually err={} action={f}", .{
|
||||
err,
|
||||
action,
|
||||
});
|
||||
|
||||
break :err false;
|
||||
// Always skip erroneous actions because we can't
|
||||
// be sure...
|
||||
break :err true;
|
||||
};
|
||||
|
||||
if (processed) continue;
|
||||
if (skip) continue;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
|
||||
Reference in New Issue
Block a user