diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-02-07 22:36:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-07 22:36:45 +0000 |
commit | 35efb4619c4b7a77b3c30de763856bc4441e236e (patch) | |
tree | 99aa70b58f97bd57c2a654e3177eae0ea0b572fa /src/renderer/mod.rs | |
parent | e561ae373393e919cf3dbbf123a98e0aad215dbc (diff) | |
download | alacritty-35efb4619c4b7a77b3c30de763856bc4441e236e.tar.gz 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/renderer/mod.rs')
-rw-r--r-- | src/renderer/mod.rs | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index e96d35a5..9a33410f 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -29,12 +29,12 @@ use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher}; use crate::gl::types::*; use crate::gl; use crate::index::{Column, Line, RangeInclusive}; -use crate::Rgb; +use crate::term::color::Rgb; use crate::config::{self, Config, Delta}; use crate::term::{self, cell, RenderableCell}; -use crate::renderer::lines::Lines; +use crate::renderer::rects::{Rect, Rects}; -pub mod lines; +pub mod rects; // Shader paths for live reload static TEXT_SHADER_F_PATH: &'static str = concat!(env!("CARGO_MANIFEST_DIR"), "/res/text.f.glsl"); @@ -668,7 +668,7 @@ impl QuadRenderer { config: &Config, props: &term::SizeInfo, visual_bell_intensity: f64, - cell_line_rects: Lines, + cell_line_rects: Rects, ) { // Swap to rectangle rendering program unsafe { @@ -866,20 +866,6 @@ impl QuadRenderer { } } -#[derive(Debug, Copy, Clone)] -pub struct Rect<T> { - x: T, - y: T, - width: T, - height: T, -} - -impl<T> Rect<T> { - pub fn new(x: T, y: T, width: T, height: T) -> Self { - Rect { x, y, width, height } - } -} - impl<'a> RenderApi<'a> { pub fn clear(&self, color: Rgb) { let alpha = self.config.background_opacity().get(); @@ -941,8 +927,9 @@ impl<'a> RenderApi<'a> { string: &str, line: Line, glyph_cache: &mut GlyphCache, - color: Rgb + color: Option<Rgb> ) { + let bg_alpha = color.map(|_| 1.0).unwrap_or(0.0); let col = Column(0); let cells = string @@ -956,10 +943,10 @@ impl<'a> RenderApi<'a> { chars[0] = c; chars }, - bg: color, + bg: color.unwrap_or(Rgb { r: 0, g: 0, b: 0}), fg: Rgb { r: 0, g: 0, b: 0 }, flags: cell::Flags::empty(), - bg_alpha: 1.0, + bg_alpha, }) .collect::<Vec<_>>(); |