From 165246f50aead3a4311df6304830a6e24ef522c8 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sun, 7 Jul 2019 14:51:11 +0000 Subject: Fix saving of ref tests Since ref tests were only stored whenever winit requested the window close, they would not get stored properly when the terminal was closed through Alacritty using `exit`, Ctrl+D or similar. This moves the ref test code to the and of the main entry point, which will always be executed regardless of how the terminal was shutdown. --- alacritty/src/cli.rs | 2 +- alacritty/src/main.rs | 54 ++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 42 insertions(+), 14 deletions(-) (limited to 'alacritty/src') diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs index dbd55634..7c1554aa 100644 --- a/alacritty/src/cli.rs +++ b/alacritty/src/cli.rs @@ -252,7 +252,7 @@ impl Options { config.window.title = self.title.or(config.window.title); if let Some(class) = self.class { - let parts : Vec<_> = class.split(',').collect(); + let parts: Vec<_> = class.split(',').collect(); config.window.class.instance = parts[0].into(); if let Some(&general) = parts.get(1) { config.window.class.general = general.into(); diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs index 54533d72..3fa3ff53 100644 --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -23,23 +23,20 @@ #![windows_subsystem = "windows"] #[cfg(target_os = "macos")] -use dirs; - -#[cfg(windows)] -use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS}; - -use log::{error, info}; - +use std::env; use std::error::Error; -use std::fs; +use std::fs::{self, File}; use std::io::{self, Write}; +#[cfg(not(windows))] +use std::os::unix::io::AsRawFd; use std::sync::Arc; #[cfg(target_os = "macos")] -use std::env; - -#[cfg(not(windows))] -use std::os::unix::io::AsRawFd; +use dirs; +use log::{error, info}; +use serde_json as json; +#[cfg(windows)] +use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS}; use alacritty_terminal::clipboard::Clipboard; use alacritty_terminal::config::{Config, Monitor}; @@ -50,7 +47,7 @@ use alacritty_terminal::locale; use alacritty_terminal::message_bar::MessageBuffer; use alacritty_terminal::panic; use alacritty_terminal::sync::FairMutex; -use alacritty_terminal::term::Term; +use alacritty_terminal::term::{cell::Cell, Term}; use alacritty_terminal::tty; use alacritty_terminal::util::fmt::Red; use alacritty_terminal::{die, event}; @@ -258,6 +255,11 @@ fn run(config: Config, message_buffer: MessageBuffer) -> Result<(), Box Result<(), Box