diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-11-17 01:15:32 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-11-17 01:15:32 -0500 |
commit | b4df28fe916ab74fe66cba60eab193ebda398eb8 (patch) | |
tree | d82372d50e2680e9a194b13dd64fb963aa40c6e9 /src/history.rs | |
parent | 49a7def10670fb8c96936d0fba09e3ed2c303f6c (diff) | |
download | nbsh-b4df28fe916ab74fe66cba60eab193ebda398eb8.tar.gz nbsh-b4df28fe916ab74fe66cba60eab193ebda398eb8.zip |
improve colors a bit
Diffstat (limited to 'src/history.rs')
-rw-r--r-- | src/history.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/history.rs b/src/history.rs index d2a1b0a..1136821 100644 --- a/src/history.rs +++ b/src/history.rs @@ -1,6 +1,7 @@ use async_std::io::{ReadExt as _, WriteExt as _}; use futures_lite::future::FutureExt as _; use pty_process::Command as _; +use std::os::unix::process::ExitStatusExt as _; use textmode::Textmode as _; pub struct History { @@ -263,7 +264,15 @@ impl HistoryEntry { ) { out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); if let Some(info) = self.exit_info { + if info.status.signal().is_some() { + out.set_fgcolor(textmode::color::MAGENTA); + } else if info.status.success() { + out.set_fgcolor(textmode::color::DARKGREY); + } else { + out.set_fgcolor(textmode::color::RED); + } out.write_str(&crate::format::exit_status(info.status)); + out.reset_attributes(); } else { out.write_str(" "); } @@ -299,7 +308,7 @@ impl HistoryEntry { let last_row = self.lines(width, focused); if last_row > 5 { out.write(b"\r\n"); - out.set_bgcolor(textmode::color::RED); + out.set_fgcolor(textmode::color::BLUE); out.write(b"..."); out.reset_attributes(); } |