From 6b61e967390b2fa4a24f962c4771cdd82e0e9de3 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sat, 8 Dec 2018 01:50:01 +0000 Subject: Fix recording of ref tests Due to the lazy initialization of lines in the Alacritty history, the recording of ref tests was broken. Because a WM would often resize the ref test window after it was spawned, some additional lines were initialized in the stored ref test. To make sure lazy initialization does not play any role in the recording and replaying of reftests, before recording and replaying the tests, the complete grid is initialized and then truncated. This should make sure that only the relevant lines are kept. --- src/event.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/event.rs') diff --git a/src/event.rs b/src/event.rs index f69136df..c9043a06 100644 --- a/src/event.rs +++ b/src/event.rs @@ -336,6 +336,7 @@ impl Processor { if ref_test { // dump grid state let mut grid = processor.ctx.terminal.grid().clone(); + grid.initialize_all(&::term::cell::Cell::default()); grid.truncate(); let serialized_grid = json::to_string(&grid) @@ -344,6 +345,11 @@ impl Processor { let serialized_size = json::to_string(processor.ctx.terminal.size_info()) .expect("serialize size"); + let serialized_config = format!( + "{{\"history_size\":{}}}", + grid.history_size() + ); + File::create("./grid.json") .and_then(|mut f| f.write_all(serialized_grid.as_bytes())) .expect("write grid.json"); @@ -351,6 +357,10 @@ impl Processor { File::create("./size.json") .and_then(|mut f| f.write_all(serialized_size.as_bytes())) .expect("write size.json"); + + File::create("./config.json") + .and_then(|mut f| f.write_all(serialized_config.as_bytes())) + .expect("write config.json"); } // FIXME should do a more graceful shutdown -- cgit