aboutsummaryrefslogtreecommitdiff
path: root/src/renderer/mod.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-10-28 09:19:48 -0700
committerJoe Wilm <joe@jwilm.com>2016-10-28 09:19:48 -0700
commita81152cc43c12f4232be29798b85ba41fd9482cb (patch)
tree86cb6102af19daaa96b3cbfb1a3ef20af0374f0e /src/renderer/mod.rs
parent7cd8a6ca12cd37ae354084c7246060219b1e3af8 (diff)
downloadr-alacritty-a81152cc43c12f4232be29798b85ba41fd9482cb.tar.gz
r-alacritty-a81152cc43c12f4232be29798b85ba41fd9482cb.tar.bz2
r-alacritty-a81152cc43c12f4232be29798b85ba41fd9482cb.zip
Support drawing bold test with bright colors
This feature is on by default
Diffstat (limited to 'src/renderer/mod.rs')
-rw-r--r--src/renderer/mod.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index 4e23c0ed..018f541c 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -242,6 +242,7 @@ pub struct QuadRenderer {
active_tex: GLuint,
batch: Batch,
colors: [Rgb; 18],
+ draw_bold_text_with_bright_colors: bool,
rx: mpsc::Receiver<Msg>,
}
@@ -271,15 +272,17 @@ pub struct Batch {
tex: GLuint,
instances: Vec<InstanceData>,
colors: [Rgb; 18],
+ draw_bold_text_with_bright_colors: bool,
}
impl Batch {
#[inline]
- pub fn new(colors: [Rgb; 18]) -> Batch {
+ pub fn new(config: &Config) -> Batch {
Batch {
tex: 0,
instances: Vec::with_capacity(BATCH_MAX),
- colors: colors,
+ colors: config.color_list(),
+ draw_bold_text_with_bright_colors: config.draw_bold_text_with_bright_colors(),
}
}
@@ -290,7 +293,16 @@ impl Batch {
let fg = match cell.fg {
::term::cell::Color::Rgb(rgb) => rgb,
- ::term::cell::Color::Ansi(ansi) => self.colors[ansi as usize],
+ ::term::cell::Color::Ansi(ansi) => {
+ if self.draw_bold_text_with_bright_colors
+ && cell.bold()
+ && ansi < ::ansi::Color::BrightBlack
+ {
+ self.colors[ansi as usize + 8]
+ } else {
+ self.colors[ansi as usize]
+ }
+ }
};
let bg = match cell.bg {
@@ -512,9 +524,10 @@ impl QuadRenderer {
vbo_instance: vbo_instance,
atlas: Vec::new(),
active_tex: 0,
- batch: Batch::new(config.color_list()),
+ batch: Batch::new(config),
colors: config.color_list(),
rx: msg_rx,
+ draw_bold_text_with_bright_colors: config.draw_bold_text_with_bright_colors(),
};
let atlas = Atlas::new(ATLAS_SIZE);
@@ -526,6 +539,7 @@ impl QuadRenderer {
pub fn update_config(&mut self, config: &Config) {
self.colors = config.color_list();
self.batch.colors = config.color_list();
+ self.batch.draw_bold_text_with_bright_colors = config.draw_bold_text_with_bright_colors();
}
pub fn with_api<F, T>(&mut self, props: &term::SizeInfo, func: F) -> T