summaryrefslogtreecommitdiffstats
path: root/ui/src
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2019-08-18 15:44:40 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2019-08-18 15:47:09 +0300
commit1845b046fa203ef9f17b37008e2e23edfbca3cf6 (patch)
treeb11421c749d8acb7e95224fe19385d8772133ecd /ui/src
parent2610e9c05510f36474873e4b2f8eb1111c93d654 (diff)
ui: add attribute support
bold/italic etc
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/components/contacts.rs2
-rw-r--r--ui/src/components/contacts/contact_list.rs6
-rw-r--r--ui/src/components/mail/accounts.rs8
-rw-r--r--ui/src/components/mail/compose.rs9
-rw-r--r--ui/src/components/mail/listing/compact.rs14
-rw-r--r--ui/src/components/mail/listing/plain.rs6
-rw-r--r--ui/src/components/mail/listing/thread.rs3
-rw-r--r--ui/src/components/mail/view.rs13
-rw-r--r--ui/src/components/mail/view/envelope.rs5
-rw-r--r--ui/src/components/mail/view/thread.rs4
-rw-r--r--ui/src/components/utilities.rs21
-rw-r--r--ui/src/components/utilities/widgets.rs6
-rw-r--r--ui/src/state.rs6
-rw-r--r--ui/src/terminal/cells.rs15
14 files changed, 109 insertions, 9 deletions
diff --git a/ui/src/components/contacts.rs b/ui/src/components/contacts.rs
index 7a7174f7..20c80768 100644
--- a/ui/src/components/contacts.rs
+++ b/ui/src/components/contacts.rs
@@ -76,6 +76,7 @@ impl ContactManager {
&mut self.content,
Color::Byte(250),
Color::Default,
+ Attr::Default,
((0, 0), (width, 0)),
false,
);
@@ -84,6 +85,7 @@ impl ContactManager {
&mut self.content,
Color::Byte(250),
Color::Default,
+ Attr::Default,
((x, 0), (width, 0)),
false,
);
diff --git a/ui/src/components/contacts/contact_list.rs b/ui/src/components/contacts/contact_list.rs
index 7da666ae..632bdefa 100644
--- a/ui/src/components/contacts/contact_list.rs
+++ b/ui/src/components/contacts/contact_list.rs
@@ -91,6 +91,7 @@ impl ContactList {
&mut self.content,
Color::Black,
Color::White,
+ Attr::Default,
((0, 0), (MAX_COLS - 1, self.length)),
false,
);
@@ -102,6 +103,7 @@ impl ContactList {
&mut self.content,
Color::Black,
Color::White,
+ Attr::Default,
((maxima.0, 0), (MAX_COLS - 1, self.length)),
false,
);
@@ -113,6 +115,7 @@ impl ContactList {
&mut self.content,
Color::Black,
Color::White,
+ Attr::Default,
((maxima.1, 0), (MAX_COLS - 1, self.length)),
false,
);
@@ -127,6 +130,7 @@ impl ContactList {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((0, i + 1), (MAX_COLS - 1, self.length)),
false,
);
@@ -135,6 +139,7 @@ impl ContactList {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((maxima.0, i + 1), (MAX_COLS - 1, self.length)),
false,
);
@@ -143,6 +148,7 @@ impl ContactList {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((maxima.1, i + 1), (MAX_COLS - 1, self.length)),
false,
);
diff --git a/ui/src/components/mail/accounts.rs b/ui/src/components/mail/accounts.rs
index 034e7f0f..ded7b002 100644
--- a/ui/src/components/mail/accounts.rs
+++ b/ui/src/components/mail/accounts.rs
@@ -110,6 +110,7 @@ impl AccountsPanel {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((2, 3), (120 - 1, 3)),
true,
);
@@ -124,6 +125,7 @@ impl AccountsPanel {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Bold,
((3, 5 + i * 10), (120 - 2, 5 + i * 10)),
true,
);
@@ -132,6 +134,7 @@ impl AccountsPanel {
&mut self.content,
Color::Byte(32),
Color::Default,
+ Attr::Default,
((x, y), (120 - 2, 5 + i * 10)),
true,
);
@@ -140,6 +143,7 @@ impl AccountsPanel {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((4, y + 2), (120 - 2, y + 2)),
true,
);
@@ -157,6 +161,7 @@ impl AccountsPanel {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((5, y + 3), (120 - 2, y + 3)),
true,
);
@@ -172,6 +177,7 @@ impl AccountsPanel {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((10 + x, y + 3), (120 - 2, y + 3)),
true,
);
@@ -180,6 +186,7 @@ impl AccountsPanel {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((5, y + 4), (120 - 2, y + 4)),
true,
);
@@ -188,6 +195,7 @@ impl AccountsPanel {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((5, y + 5), (120 - 2, y + 5)),
true,
);
diff --git a/ui/src/components/mail/compose.rs b/ui/src/components/mail/compose.rs
index 014a88fb..4e76b61e 100644
--- a/ui/src/components/mail/compose.rs
+++ b/ui/src/components/mail/compose.rs
@@ -225,6 +225,7 @@ impl Composer {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
(pos_inc(upper_left!(area), (0, 1)), bottom_right!(area)),
false,
);
@@ -234,6 +235,7 @@ impl Composer {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
(pos_inc(upper_left!(area), (0, 1)), bottom_right!(area)),
false,
);
@@ -250,6 +252,7 @@ impl Composer {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
(pos_inc(upper_left!(area), (0, 2 + i)), bottom_right!(area)),
false,
);
@@ -259,6 +262,7 @@ impl Composer {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
(pos_inc(upper_left!(area), (0, 2 + i)), bottom_right!(area)),
false,
);
@@ -388,6 +392,7 @@ impl Component for Composer {
grid,
Color::Byte(189),
Color::Byte(167),
+ Attr::Default,
(
pos_dec(upper_left!(header_area), (0, 1)),
bottom_right!(header_area),
@@ -437,6 +442,7 @@ impl Component for Composer {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
area,
true,
);
@@ -445,6 +451,7 @@ impl Component for Composer {
grid,
Color::Byte(124),
Color::Default,
+ Attr::Default,
(set_y(upper_left!(area), y + 2), bottom_right!(area)),
true,
);
@@ -453,6 +460,7 @@ impl Component for Composer {
grid,
Color::Byte(124),
Color::Default,
+ Attr::Default,
(set_y(upper_left!(area), y + 1), bottom_right!(area)),
true,
);
@@ -461,6 +469,7 @@ impl Component for Composer {
grid,
Color::Byte(124),
Color::Default,
+ Attr::Default,
(set_y(upper_left!(area), y + 1), bottom_right!(area)),
true,
);
diff --git a/ui/src/components/mail/listing/compact.rs b/ui/src/components/mail/listing/compact.rs
index bc98b46f..439803a9 100644
--- a/ui/src/components/mail/listing/compact.rs
+++ b/ui/src/components/mail/listing/compact.rs
@@ -432,6 +432,7 @@ impl ListingTrait for CompactListing {
&mut self.data_columns.columns[0],
Color::Default,
Color::Default,
+ Attr::Default,
((0, 0), (MAX_COLS - 1, 0)),
false,
);
@@ -556,6 +557,7 @@ impl CompactListing {
&mut self.data_columns.columns[0],
Color::Default,
Color::Default,
+ Attr::Default,
((0, 0), (MAX_COLS - 1, 0)),
false,
);
@@ -681,6 +683,7 @@ impl CompactListing {
&mut self.data_columns.columns[0],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.0, idx)),
false,
);
@@ -692,6 +695,7 @@ impl CompactListing {
&mut self.data_columns.columns[1],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.1, idx)),
false,
);
@@ -703,6 +707,7 @@ impl CompactListing {
&mut self.data_columns.columns[2],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.2, idx)),
false,
);
@@ -714,6 +719,7 @@ impl CompactListing {
&mut self.data_columns.columns[3],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.3, idx)),
false,
);
@@ -725,6 +731,7 @@ impl CompactListing {
&mut self.data_columns.columns[4],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.4, idx)),
false,
);
@@ -759,6 +766,7 @@ impl CompactListing {
&mut self.data_columns.columns[0],
Color::Default,
Color::Default,
+ Attr::Default,
((0, 0), (MAX_COLS - 1, 0)),
false,
);
@@ -852,6 +860,7 @@ impl CompactListing {
&mut self.data_columns.columns[0],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.0, idx)),
false,
);
@@ -863,6 +872,7 @@ impl CompactListing {
&mut self.data_columns.columns[1],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.1, idx)),
false,
);
@@ -874,6 +884,7 @@ impl CompactListing {
&mut self.data_columns.columns[2],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.2, idx)),
false,
);
@@ -885,6 +896,7 @@ impl CompactListing {
&mut self.data_columns.columns[3],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.3, idx)),
false,
);
@@ -896,6 +908,7 @@ impl CompactListing {
&mut self.data_columns.columns[4],
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (min_width.4, idx)),
false,
);
@@ -958,6 +971,7 @@ impl Component for CompactListing {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
area,
true,
);
diff --git a/ui/src/components/mail/listing/plain.rs b/ui/src/components/mail/listing/plain.rs
index 5078d5d7..617466bd 100644
--- a/ui/src/components/mail/listing/plain.rs
+++ b/ui/src/components/mail/listing/plain.rs
@@ -280,6 +280,7 @@ impl PlainListing {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((0, 0), (MAX_COLS - 1, 0)),
false,
);
@@ -297,6 +298,7 @@ impl PlainListing {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((0, 0), (MAX_COLS - 1, 0)),
true,
);
@@ -379,6 +381,7 @@ impl PlainListing {
&mut self.content,
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (widths.0, idx)),
false,
);
@@ -391,6 +394,7 @@ impl PlainListing {
&mut self.content,
fg_color,
bg_color,
+ Attr::Default,
((_x, idx), (widths.1 + _x, idx)),
false,
);
@@ -403,6 +407,7 @@ impl PlainListing {
&mut self.content,
fg_color,
bg_color,
+ Attr::Default,
((_x, idx), (widths.1 + _x, idx)),
false,
);
@@ -415,6 +420,7 @@ impl PlainListing {
&mut self.content,
fg_color,
bg_color,
+ Attr::Default,
((_x, idx), (widths.2 + _x, idx)),
false,
);
diff --git a/ui/src/components/mail/listing/thread.rs b/ui/src/components/mail/listing/thread.rs
index 6dad325f..e9fb9d29 100644
--- a/ui/src/components/mail/listing/thread.rs
+++ b/ui/src/components/mail/listing/thread.rs
@@ -259,6 +259,7 @@ impl ThreadListing {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((0, 0), (MAX_COLS - 1, 0)),
false,
);
@@ -278,6 +279,7 @@ impl ThreadListing {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((0, 0), (MAX_COLS - 1, 0)),
true,
);
@@ -326,6 +328,7 @@ impl ThreadListing {
&mut self.content,
fg_color,
bg_color,
+ Attr::Default,
((0, idx), (MAX_COLS - 1, idx)),
false,
);
diff --git a/ui/src/components/mail/view.rs b/ui/src/components/mail/view.rs
index cfc89be3..aa3f04cc 100644
--- a/ui/src/components/mail/view.rs
+++ b/ui/src/components/mail/view.rs
@@ -318,6 +318,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
area,
true,
);
@@ -331,6 +332,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
@@ -344,6 +346,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
@@ -357,6 +360,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
@@ -370,6 +374,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
@@ -384,6 +389,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
@@ -405,6 +411,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, _y + 1), bottom_right),
true,
);
@@ -430,6 +437,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y), bottom_right),
false,
);
@@ -438,6 +446,7 @@ impl Component for MailView {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
((_x, y), bottom_right),
false,
);
@@ -449,6 +458,7 @@ impl Component for MailView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
((x, y), bottom_right),
false,
);
@@ -460,6 +470,7 @@ impl Component for MailView {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
((x, y), bottom_right),
false,
);
@@ -471,6 +482,7 @@ impl Component for MailView {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
((x, y), bottom_right),
false,
);
@@ -482,6 +494,7 @@ impl Component for MailView {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
((x, y), bottom_right),
false,
);
diff --git a/ui/src/components/mail/view/envelope.rs b/ui/src/components/mail/view/envelope.rs
index bbe97e3e..cc708868 100644
--- a/ui/src/components/mail/view/envelope.rs
+++ b/ui/src/components/mail/view/envelope.rs
@@ -240,6 +240,7 @@ impl Component for EnvelopeView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
area,
true,
);
@@ -253,6 +254,7 @@ impl Component for EnvelopeView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
@@ -266,6 +268,7 @@ impl Component for EnvelopeView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
@@ -279,6 +282,7 @@ impl Component for EnvelopeView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
@@ -292,6 +296,7 @@ impl Component for EnvelopeView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
(set_y(upper_left, y + 1), bottom_right),
true,
);
diff --git a/ui/src/components/mail/view/thread.rs b/ui/src/components/mail/view/thread.rs
index acb443ce..0171bdc4 100644
--- a/ui/src/components/mail/view/thread.rs
+++ b/ui/src/components/mail/view/thread.rs
@@ -257,6 +257,7 @@ impl ThreadView {
} else {
Color::Byte(251)
},
+ Attr::Default,
(
(e.index.0 * 4 + 1, 2 * y),
(e.index.0 * 4 + e.heading.grapheme_width() + 1, height - 1),
@@ -333,6 +334,7 @@ impl ThreadView {
} else {
Color::Byte(251)
},
+ Attr::Default,
(
(e.index.0 * 4 + 1, 2 * y),
(e.index.0 * 4 + e.heading.grapheme_width() + 1, height - 1),
@@ -626,6 +628,7 @@ impl ThreadView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
area,
true,
);
@@ -711,6 +714,7 @@ impl ThreadView {
grid,
Color::Byte(33),
Color::Default,
+ Attr::Default,
area,
true,
);
diff --git a/ui/src/components/utilities.rs b/ui/src/components/utilities.rs
index 72b9e710..c9289585 100644
--- a/ui/src/components/utilities.rs
+++ b/ui/src/components/utilities.rs
@@ -420,6 +420,7 @@ impl Pager {
content,
Color::Default,
Color::Default,
+ Attr::Default,
((0, i), (width - 1, i)),
true,
);
@@ -646,15 +647,21 @@ impl StatusBar {
grid,
Color::Byte(123),
Color::Byte(26),
+ Attr::Default,
area,
false,
);
+ let offset = self.status.find('|').unwrap_or_else(|| self.status.len());
+ for x in get_x(upper_left!(area))..get_x(upper_left!(area)) + offset {
+ grid[(x, y)].set_attrs(Attr::Bold);
+ }
if let Some(n) = self.notifications.pop_front() {
write_string_to_grid(
&n,
grid,
Color::Byte(219),
Color::Byte(88),
+ Attr::Default,
(
(std::cmp::max(x, width!(area).saturating_sub(n.len())), y),
bottom_right!(area),
@@ -676,14 +683,16 @@ impl StatusBar {
}
fn draw_execute_bar(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
clear_area(grid, area);
- write_string_to_grid(
+ let (x, y) = write_string_to_grid(
self.ex_buffer.as_str(),
grid,
Color::Byte(219),
Color::Byte(88),
+ Attr::Default,
area,
false,
);
+ grid[(x, y)].set_attrs(Attr::Underline);
change_colors(grid, area, Color::Byte(219), Color::Byte(88));
context.dirty_areas.push_back(area);
}
@@ -852,6 +861,7 @@ impl Component for StatusBar {
grid,
Color::Byte(88), // DarkRed,
Color::Byte(174), //LightPink3
+ Attr::Default,
(
set_y(
upper_left!(hist_area),
@@ -866,6 +876,7 @@ impl Component for StatusBar {
grid,
Color::White,
Color::Byte(174),
+ Attr::Default,
((x + 2, y), bottom_right!(hist_area)),
false,
);
@@ -890,6 +901,7 @@ impl Component for StatusBar {
grid,
Color::Byte(97), // MediumPurple3,
Color::Byte(88), //LightPink3
+ Attr::Default,
(
(
get_y(upper_left)
@@ -1144,6 +1156,7 @@ impl Tabbed {
grid,
fg,
bg,
+ Attr::Default,
(set_x(upper_left, x), bottom_right!(area)),
false,
);
@@ -1241,6 +1254,7 @@ impl Component for Tabbed {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
(
pos_inc(upper_left!(area), (2, 1 + idx)),
set_x(
@@ -1259,6 +1273,7 @@ impl Component for Tabbed {
grid,
Color::Byte(29),
Color::Default,
+ Attr::Default,
(
pos_inc(upper_left!(area), (2, 1 + idx)),
set_x(
@@ -1273,6 +1288,7 @@ impl Component for Tabbed {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
(
(x + 2, y),
set_x(
@@ -1413,6 +1429,7 @@ impl Component for Selector {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((1, self.cursor), (width, self.cursor)),
false,
);
@@ -1422,6 +1439,7 @@ impl Component for Selector {
&mut self.content,
Color::Default,
Color::Default,
+ Attr::Default,
((1, self.cursor), (width, self.cursor)),
false,
);
@@ -1479,6 +1497,7 @@ impl Selector {
&mut content,
Color::Default,
Color::Default,
+ Attr::Default,
((0, i), (width - 1, i)),
false,
);
diff --git a/ui/src/components/utilities/widgets.rs b/ui/src/components/utilities/widgets.rs
index 1582668f..b84f0ea2 100644
--- a/ui/src/components/utilities/widgets.rs
+++ b/ui/src/components/utilities/widgets.rs
@@ -111,6 +111,7 @@ impl Component for Field {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
area,
true,
);
@@ -317,6 +318,7 @@ impl Component for FormWidget {
grid,
Color::Default,
Color::Default,
+ Attr::Default,
(
pos_inc(upper_left, (1, i)),
set_y(bottom_right, i + get_y(upper_left)),
@@ -530,6 +532,7 @@ where
} else {
Color::Default
},
+ Attr::Default,
(
pos_inc(upper_left, (len, 0)),
pos_inc(upper_left, (cur_len + len, 0)),
@@ -712,6 +715,7 @@ impl AutoComplete {
&mut content,
Color::Byte(23),
Color::Byte(7),
+ Attr::Default,
((0, i), (width - 1, i)),
false,
);
@@ -720,6 +724,7 @@ impl AutoComplete {
&mut content,
Color::Byte(23),
Color::Byte(7),
+ Attr::Default,
((x + 2, i), (width - 1, i)),
false,
);
@@ -728,6 +733,7 @@ impl AutoComplete {
&mut content,
Color::Byte(23),
Color::Byte(7),
+ Attr::Default,
((width - 1, i), (width - 1, i)),
false,
);
diff --git a/ui/src/state.rs b/ui/src/state.rs
index 896ebb59..c3479db1 100644
--- a/ui/src/state.rs
+++ b/ui/src/state.rs
@@ -421,6 +421,9 @@ impl State {
if c.fg() != Color::Default {
write!(self.stdout(), "{}", termion::color::Fg(c.fg().as_termion())).unwrap();
}
+ if c.attrs() != Attr::Default {
+ write!(self.stdout(), "\x1B[{}m", c.attrs() as u8).unwrap();
+ }
if !c.empty() {
write!(self.stdout(), "{}", c.ch()).unwrap();
}
@@ -441,6 +444,9 @@ impl State {
)
.unwrap();
}
+ if c.attrs() != Attr::Default {
+ write!(self.stdout(), "\x1B[{}m", Attr::Default as u8).unwrap();
+ }
}
}
diff --git a/ui/src/terminal/cells.rs b/ui/src/terminal/cells.rs
index 6208ccef..0540365a 100644
--- a/ui/src/terminal/cells.rs
+++ b/ui/src/terminal/cells.rs
@@ -571,9 +571,9 @@ impl Color {
pub enum Attr {
Default = 0b000,
Bold = 0b001,
- Underline = 0b010,
+ Underline = 0b100,
BoldUnderline = 0b011,
- Reverse = 0b100,
+ Reverse = 0b010,
BoldReverse = 0b101,
UnderlineReverse = 0b110,
BoldReverseUnderline = 0b111,
@@ -725,6 +725,7 @@ pub fn write_string_to_grid(
grid: &mut CellBuffer,
fg_color: Color,
bg_color: Color,
+ attrs: Attr,
area: Area,
line_break: bool,
) -> Pos {
@@ -748,19 +749,16 @@ pub fn write_string_to_grid(
if c == '\r' {
continue;
}
+ grid[(x, y)].set_attrs(attrs);
+ grid[(x, y)].set_fg(fg_color);
+ grid[(x, y)].set_bg(bg_color);
if c == '\t' {
grid[(x, y)].set_ch(' ');
- grid[(x, y)].set_fg(fg_color);
- grid[(x, y)].set_bg(bg_color);
x += 1;
inspect_bounds!(grid, area, x, y, line_break);
grid[(x, y)].set_ch(' ');
- grid[(x, y)].set_fg(fg_color);
- grid[(x, y)].set_bg(bg_color);
} else {
grid[(x, y)].set_ch(c);
- grid[(x, y)].set_fg(fg_color);
- grid[(x, y)].set_bg(bg_color);
}
match wcwidth(u32::from(c)) {
@@ -796,6 +794,7 @@ pub fn clear_area(grid: &mut CellBuffer, area: Area) {
grid[(x, y)].set_ch(' ');
grid[(x, y)].set_bg(Color::Default);
grid[(x, y)].set_fg(Color::Default);
+ grid[(x, y)].set_attrs(Attr::Default);
grid[(x, y)].empty = false;
}
}