This commit is contained in:
@@ -288,6 +288,7 @@ pub enum ShellAction {
|
||||
SetCommandPaletteQuery(String),
|
||||
SyntheticStreamTick,
|
||||
AppendExternalOutput { pane: PaneId, lines: Vec<String> },
|
||||
ReplaceExternalOutput { pane: PaneId, lines: Vec<String> },
|
||||
}
|
||||
|
||||
/// Counters prove both candidates replayed the same workload. Framework
|
||||
@@ -308,6 +309,7 @@ pub struct MeasurementCounters {
|
||||
pub terminal_lines_appended: u64,
|
||||
pub external_output_batches: u64,
|
||||
pub external_lines_appended: u64,
|
||||
pub external_snapshot_updates: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
@@ -536,6 +538,21 @@ impl ShellModel {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
ShellAction::ReplaceExternalOutput { pane, mut lines } => {
|
||||
let pane = &mut self.panes[pane.index()];
|
||||
if pane.output_source == OutputSource::External {
|
||||
if lines.len() > self.terminal_line_limit {
|
||||
lines.drain(..lines.len() - self.terminal_line_limit);
|
||||
}
|
||||
if pane.lines != lines {
|
||||
pane.lines = lines;
|
||||
self.counters.surface_updates += 1;
|
||||
self.counters.external_output_batches += 1;
|
||||
self.counters.external_snapshot_updates += 1;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if changed {
|
||||
self.revision += 1;
|
||||
@@ -786,6 +803,14 @@ mod tests {
|
||||
assert_eq!(model.counters().surface_updates, 6);
|
||||
assert_eq!(model.counters().external_output_batches, 1);
|
||||
assert_eq!(model.counters().external_lines_appended, 2);
|
||||
|
||||
let snapshot = model.dispatch(ShellAction::ReplaceExternalOutput {
|
||||
pane: PaneId::CodexRuntime,
|
||||
lines: vec!["prompt $".into()],
|
||||
});
|
||||
assert!(snapshot.changed);
|
||||
assert_eq!(model.pane(PaneId::CodexRuntime).lines(), ["prompt $"]);
|
||||
assert_eq!(model.counters().external_snapshot_updates, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user