address review comments
parent
07124dba64
commit
1c23ebc6f1
|
|
@ -153,7 +153,7 @@ selection_scroll_active: bool = false,
|
||||||
/// precision timestamp. It does not necessarily need to correspond to the
|
/// precision timestamp. It does not necessarily need to correspond to the
|
||||||
/// actual time, but we must be able to compare two subsequent timestamps to get
|
/// actual time, but we must be able to compare two subsequent timestamps to get
|
||||||
/// the wall clock time that has elapsed between timestamps.
|
/// the wall clock time that has elapsed between timestamps.
|
||||||
command_timer: ?i128 = null,
|
command_timer: ?std.time.Instant = null,
|
||||||
|
|
||||||
/// The effect of an input event. This can be used by callers to take
|
/// The effect of an input event. This can be used by callers to take
|
||||||
/// the appropriate action after an input event. For example, key
|
/// the appropriate action after an input event. For example, key
|
||||||
|
|
@ -999,22 +999,16 @@ pub fn handleMessage(self: *Surface, msg: Message) !void {
|
||||||
try self.selectionScrollTick();
|
try self.selectionScrollTick();
|
||||||
},
|
},
|
||||||
|
|
||||||
.start_command_timer => {
|
.start_command => {
|
||||||
self.command_timer = std.time.nanoTimestamp();
|
self.command_timer = try .now();
|
||||||
},
|
},
|
||||||
|
|
||||||
.stop_command_timer => |v| timer: {
|
.stop_command => |v| timer: {
|
||||||
const end = std.time.nanoTimestamp();
|
const end: std.time.Instant = try .now();
|
||||||
const start = self.command_timer orelse break :timer;
|
const start = self.command_timer orelse break :timer;
|
||||||
self.command_timer = null;
|
self.command_timer = null;
|
||||||
|
|
||||||
const difference = end - start;
|
const duration: Duration = .{ .duration = end.since(start) };
|
||||||
|
|
||||||
// skip obviously silly results
|
|
||||||
if (difference < 0) break :timer;
|
|
||||||
if (difference > std.math.maxInt(u64)) break :timer;
|
|
||||||
|
|
||||||
const duration: Duration = .{ .duration = @intCast(difference) };
|
|
||||||
log.debug("command took {}", .{duration});
|
log.debug("command took {}", .{duration});
|
||||||
|
|
||||||
_ = self.rt_app.performAction(
|
_ = self.rt_app.performAction(
|
||||||
|
|
|
||||||
|
|
@ -97,12 +97,12 @@ pub const Message = union(enum) {
|
||||||
progress_report: terminal.osc.Command.ProgressReport,
|
progress_report: terminal.osc.Command.ProgressReport,
|
||||||
|
|
||||||
/// A command has started in the shell, start a timer.
|
/// A command has started in the shell, start a timer.
|
||||||
start_command_timer,
|
start_command,
|
||||||
|
|
||||||
/// A command has finished in the shell, stop the timer and send out
|
/// A command has finished in the shell, stop the timer and send out
|
||||||
/// notifications as appropriate. The optional u8 is the exit code
|
/// notifications as appropriate. The optional u8 is the exit code
|
||||||
/// of the command.
|
/// of the command.
|
||||||
stop_command_timer: ?u8,
|
stop_command: ?u8,
|
||||||
|
|
||||||
pub const ReportTitleStyle = enum {
|
pub const ReportTitleStyle = enum {
|
||||||
csi_21_t,
|
csi_21_t,
|
||||||
|
|
|
||||||
|
|
@ -1054,11 +1054,11 @@ pub const StreamHandler = struct {
|
||||||
|
|
||||||
pub inline fn endOfInput(self: *StreamHandler) !void {
|
pub inline fn endOfInput(self: *StreamHandler) !void {
|
||||||
self.terminal.markSemanticPrompt(.command);
|
self.terminal.markSemanticPrompt(.command);
|
||||||
self.surfaceMessageWriter(.start_command_timer);
|
self.surfaceMessageWriter(.start_command);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn endOfCommand(self: *StreamHandler, exit_code: ?u8) !void {
|
pub inline fn endOfCommand(self: *StreamHandler, exit_code: ?u8) !void {
|
||||||
self.surfaceMessageWriter(.{ .stop_command_timer = exit_code });
|
self.surfaceMessageWriter(.{ .stop_command = exit_code });
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reportPwd(self: *StreamHandler, url: []const u8) !void {
|
pub fn reportPwd(self: *StreamHandler, url: []const u8) !void {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue