mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
parent
28b726cbfa
commit
f51c7b067a
3 changed files with 3 additions and 42 deletions
|
@ -49,7 +49,6 @@ use alacritty_terminal::panic;
|
|||
use alacritty_terminal::sync::FairMutex;
|
||||
use alacritty_terminal::term::{cell::Cell, Term};
|
||||
use alacritty_terminal::tty;
|
||||
use alacritty_terminal::util::fmt::Red;
|
||||
use alacritty_terminal::{die, event};
|
||||
|
||||
mod cli;
|
||||
|
@ -109,7 +108,7 @@ fn main() {
|
|||
|
||||
// Run alacritty
|
||||
if let Err(err) = run(config, message_buffer) {
|
||||
die!("Alacritty encountered an unrecoverable error:\n\n\t{}\n", Red(err));
|
||||
die!("Alacritty encountered an unrecoverable error:\n\n\t{}\n", err);
|
||||
}
|
||||
|
||||
// Clean up logfile
|
||||
|
|
|
@ -44,43 +44,6 @@ pub fn limit<T: Ord>(value: T, min: T, max: T) -> T {
|
|||
cmp::min(cmp::max(value, min), max)
|
||||
}
|
||||
|
||||
/// Utilities for writing to the
|
||||
pub mod fmt {
|
||||
use std::fmt;
|
||||
|
||||
macro_rules! define_colors {
|
||||
($($(#[$attrs:meta])* pub struct $s:ident => $color:expr;)*) => {
|
||||
$(
|
||||
$(#[$attrs])*
|
||||
pub struct $s<T>(pub T);
|
||||
|
||||
impl<T: fmt::Display> fmt::Display for $s<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, concat!("\x1b[", $color, "m{}\x1b[0m"), self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: fmt::Debug> fmt::Debug for $s<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, concat!("\x1b[", $color, "m{:?}\x1b[0m"), self.0)
|
||||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
define_colors! {
|
||||
/// Write a `Display` or `Debug` escaped with Red
|
||||
pub struct Red => "31";
|
||||
|
||||
/// Write a `Display` or `Debug` escaped with Green
|
||||
pub struct Green => "32";
|
||||
|
||||
/// Write a `Display` or `Debug` escaped with Yellow
|
||||
pub struct Yellow => "33";
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub fn start_daemon<I, S>(program: &str, args: I) -> io::Result<()>
|
||||
where
|
||||
|
|
|
@ -13,7 +13,6 @@ use alacritty_terminal::index::Column;
|
|||
use alacritty_terminal::message_bar::MessageBuffer;
|
||||
use alacritty_terminal::term::cell::Cell;
|
||||
use alacritty_terminal::term::SizeInfo;
|
||||
use alacritty_terminal::util::fmt::{Green, Red};
|
||||
use alacritty_terminal::Grid;
|
||||
use alacritty_terminal::Term;
|
||||
|
||||
|
@ -116,8 +115,8 @@ fn ref_test(dir: &Path) {
|
|||
"[{i}][{j}] {original:?} => {now:?}",
|
||||
i = i,
|
||||
j = j,
|
||||
original = Green(original_cell),
|
||||
now = Red(cell)
|
||||
original = original_cell,
|
||||
now = cell,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue