aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-02-07 22:36:45 +0000
committerGitHub <noreply@github.com>2019-02-07 22:36:45 +0000
commit35efb4619c4b7a77b3c30de763856bc4441e236e (patch)
tree99aa70b58f97bd57c2a654e3177eae0ea0b572fa /src/lib.rs
parente561ae373393e919cf3dbbf123a98e0aad215dbc (diff)
downloadr-alacritty-35efb4619c4b7a77b3c30de763856bc4441e236e.tar.gz
r-alacritty-35efb4619c4b7a77b3c30de763856bc4441e236e.tar.bz2
r-alacritty-35efb4619c4b7a77b3c30de763856bc4441e236e.zip
Dynamically resize terminal for errors/warnings
The warning and error messages now don't overwrite other terminal content anymore but instead resize the terminal to make sure that text can always be read. Instead of just showing that there is a new error and pointing to the log, errors will now be displayed fully in multiple lines of text, assuming that there is enough space left in the terminal. Explicit mouse click handling has also been added to the message bar, which made it possible to add a simple `close` button in the form of `[X]`. Alacritty's log file location is now stored in the `$ALACRITTY_LOG` environment variable which the shell inherits automatically. Previously there were some issues with the log file only being deleted when certain methods for closing Alacritty were used (like typing `exit`). This has been reworked and now Ctrl+D, exit and signals should all work properly. Before the config is reloaded, all current messages are now dropped. This should help with multiple terminals all getting clogged up at the same time when the config is broken. When one message is removed, all other duplicate messages are automatically removed too.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/lib.rs b/src/lib.rs
index f99510f2..8cf0f026 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -46,10 +46,9 @@ pub mod term;
pub mod tty;
pub mod util;
pub mod window;
+pub mod message_bar;
mod url;
-use std::ops::Mul;
-
pub use crate::grid::Grid;
pub use crate::term::Term;
@@ -60,31 +59,6 @@ pub enum MouseCursor {
Text,
}
-#[derive(Debug, Eq, PartialEq, Copy, Clone, Default, Serialize, Deserialize)]
-pub struct Rgb {
- pub r: u8,
- pub g: u8,
- pub b: u8,
-}
-
-// a multiply function for Rgb, as the default dim is just *2/3
-impl Mul<f32> for Rgb {
- type Output = Rgb;
-
- fn mul(self, rhs: f32) -> Rgb {
- let result = Rgb {
- r: (f32::from(self.r) * rhs).max(0.0).min(255.0) as u8,
- g: (f32::from(self.g) * rhs).max(0.0).min(255.0) as u8,
- b: (f32::from(self.b) * rhs).max(0.0).min(255.0) as u8
- };
-
- trace!("Scaling RGB by {} from {:?} to {:?}", rhs, self, result);
-
- result
- }
-}
-
-
pub mod gl {
#![allow(clippy::all)]
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));