terminal/cells: rename write_string{to_grid,}
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>pull/312/head
parent
e0adcdfe15
commit
7645ff1b87
|
@ -79,7 +79,7 @@ impl ContactManager {
|
|||
fn initialize(&mut self, context: &Context) {
|
||||
let (width, _) = self.content.size();
|
||||
|
||||
let (x, _) = self.content.write_string_to_grid(
|
||||
let (x, _) = self.content.write_string(
|
||||
"Last edited: ",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -87,7 +87,7 @@ impl ContactManager {
|
|||
((0, 0), (width - 1, 0)),
|
||||
None,
|
||||
);
|
||||
let (x, y) = self.content.write_string_to_grid(
|
||||
let (x, y) = self.content.write_string(
|
||||
&self.card.last_edited(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -99,7 +99,7 @@ impl ContactManager {
|
|||
if self.card.external_resource() {
|
||||
self.mode = ViewMode::ReadOnly;
|
||||
_ = self.content.resize(self.content.size().0, 2, None);
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
"This contact's origin is external and cannot be edited within meli.",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
|
|
@ -161,7 +161,7 @@ impl ContactList {
|
|||
for (idx, c) in book_values.iter().enumerate() {
|
||||
self.id_positions.push(*c.id());
|
||||
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
c.name(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -170,7 +170,7 @@ impl ContactList {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[1].write_string_to_grid(
|
||||
self.data_columns.columns[1].write_string(
|
||||
c.email(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -179,7 +179,7 @@ impl ContactList {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[2].write_string_to_grid(
|
||||
self.data_columns.columns[2].write_string(
|
||||
c.url(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -188,7 +188,7 @@ impl ContactList {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[3].write_string_to_grid(
|
||||
self.data_columns.columns[3].write_string(
|
||||
if c.external_resource() {
|
||||
"external"
|
||||
} else {
|
||||
|
@ -206,7 +206,7 @@ impl ContactList {
|
|||
let message = "Address book is empty.".to_string();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), self.length, None, context);
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
&message,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -277,7 +277,7 @@ impl ContactList {
|
|||
|
||||
if a.name.grapheme_len() + s.len() > width + 1 {
|
||||
/* Print account name */
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&a.name,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
|
@ -285,7 +285,7 @@ impl ContactList {
|
|||
area,
|
||||
None,
|
||||
);
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&s,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
|
@ -299,7 +299,7 @@ impl ContactList {
|
|||
),
|
||||
None,
|
||||
);
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
"…",
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
|
@ -323,7 +323,7 @@ impl ContactList {
|
|||
} else {
|
||||
/* Print account name */
|
||||
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&a.name,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
|
@ -331,7 +331,7 @@ impl ContactList {
|
|||
area,
|
||||
None,
|
||||
);
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&s,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
|
@ -485,7 +485,7 @@ impl ContactList {
|
|||
continue;
|
||||
}
|
||||
let (column_width, column_height) = self.data_columns.columns[i].size();
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
match i {
|
||||
0 => "NAME",
|
||||
1 => "E-MAIL",
|
||||
|
|
|
@ -170,7 +170,7 @@ impl JobManager {
|
|||
CellBuffer::new_with_context(self.min_width[4], self.length, None, context);
|
||||
|
||||
for (idx, e) in self.entries.values().enumerate() {
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
&e.id.to_string(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -179,7 +179,7 @@ impl JobManager {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[1].write_string_to_grid(
|
||||
self.data_columns.columns[1].write_string(
|
||||
&e.desc,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -188,7 +188,7 @@ impl JobManager {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[2].write_string_to_grid(
|
||||
self.data_columns.columns[2].write_string(
|
||||
&datetime::timestamp_to_string(e.started, Some(RFC3339_DATETIME_AND_SPACE), true),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -197,7 +197,7 @@ impl JobManager {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[3].write_string_to_grid(
|
||||
self.data_columns.columns[3].write_string(
|
||||
&if let Some(t) = e.finished {
|
||||
Cow::Owned(datetime::timestamp_to_string(
|
||||
t,
|
||||
|
@ -214,7 +214,7 @@ impl JobManager {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[4].write_string_to_grid(
|
||||
self.data_columns.columns[4].write_string(
|
||||
&if e.finished.is_some() {
|
||||
Cow::Owned(format!("{:?}", e.succeeded))
|
||||
} else {
|
||||
|
@ -232,7 +232,7 @@ impl JobManager {
|
|||
let message = "No jobs.".to_string();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), self.length, None, context);
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
&message,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -393,7 +393,7 @@ impl Component for JobManager {
|
|||
let mut x_offset = 0;
|
||||
let (upper_left, bottom_right) = area;
|
||||
for (i, (h, w)) in Self::HEADERS.iter().zip(self.min_width).enumerate() {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
h,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -409,7 +409,7 @@ impl Component for JobManager {
|
|||
(false, Asc) => DataColumns::<5>::ARROW_UP,
|
||||
(false, Desc) => DataColumns::<5>::ARROW_DOWN,
|
||||
};
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
arrow,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
|
|
@ -691,7 +691,7 @@ To: {}
|
|||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!(
|
||||
"☑ sign with {}",
|
||||
if self.gpg_state.sign_keys.is_empty() {
|
||||
|
@ -711,7 +711,7 @@ To: {}
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
"☐ don't sign",
|
||||
theme_default.fg,
|
||||
if self.cursor == Cursor::Sign {
|
||||
|
@ -734,7 +734,7 @@ To: {}
|
|||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!(
|
||||
"{}{}",
|
||||
if self.gpg_state.encrypt_keys.is_empty() {
|
||||
|
@ -759,7 +759,7 @@ To: {}
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
"☐ don't encrypt",
|
||||
theme_default.fg,
|
||||
if self.cursor == Cursor::Encrypt {
|
||||
|
@ -773,7 +773,7 @@ To: {}
|
|||
);
|
||||
}
|
||||
if attachments_no == 0 {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
"no attachments",
|
||||
theme_default.fg,
|
||||
if self.cursor == Cursor::Attachments {
|
||||
|
@ -786,7 +786,7 @@ To: {}
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!("{} attachments ", attachments_no),
|
||||
theme_default.fg,
|
||||
if self.cursor == Cursor::Attachments {
|
||||
|
@ -800,7 +800,7 @@ To: {}
|
|||
);
|
||||
for (i, a) in self.draft.attachments().iter().enumerate() {
|
||||
if let Some(name) = a.content_type().name() {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!(
|
||||
"[{}] \"{}\", {} {}",
|
||||
i,
|
||||
|
@ -815,7 +815,7 @@ To: {}
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!(
|
||||
"[{}] {} {}",
|
||||
i,
|
||||
|
@ -944,7 +944,7 @@ impl Component for Composer {
|
|||
),
|
||||
);
|
||||
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
if self.reply_context.is_some() {
|
||||
"COMPOSING REPLY"
|
||||
} else {
|
||||
|
@ -1055,7 +1055,7 @@ impl Component for Composer {
|
|||
.iter()
|
||||
.enumerate()
|
||||
{
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
l,
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
|
|
|
@ -125,7 +125,7 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
|
|||
let theme_default = crate::conf::value(context, "theme_default");
|
||||
grid.clear_area(area, theme_default);
|
||||
if attachments_no == 0 {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
"no attachments",
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
|
@ -134,7 +134,7 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!("{} attachments ", attachments_no),
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
|
@ -153,7 +153,7 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
|
|||
theme_default.bg
|
||||
};
|
||||
if let Some(name) = a.content_type().name() {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!(
|
||||
"[{}] \"{}\", {} {}",
|
||||
i,
|
||||
|
@ -168,7 +168,7 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!(
|
||||
"[{}] {} {}",
|
||||
i,
|
||||
|
|
|
@ -89,7 +89,7 @@ impl Component for KeySelection {
|
|||
} => progress_spinner.draw(grid, center_area(area, (2, 2)), context),
|
||||
KeySelection::Error { ref err, .. } => {
|
||||
let theme_default = crate::conf::value(context, "theme_default");
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&err.to_string(),
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
|
|
|
@ -2653,7 +2653,7 @@ impl Listing {
|
|||
};
|
||||
|
||||
/* Print account name first */
|
||||
self.menu_content.write_string_to_grid(
|
||||
self.menu_content.write_string(
|
||||
&self.accounts[aidx].name,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
|
@ -2663,7 +2663,7 @@ impl Listing {
|
|||
);
|
||||
|
||||
if lines.is_empty() {
|
||||
self.menu_content.write_string_to_grid(
|
||||
self.menu_content.write_string(
|
||||
"offline",
|
||||
crate::conf::value(context, "error_message").fg,
|
||||
account_attrs.bg,
|
||||
|
@ -2804,7 +2804,7 @@ impl Listing {
|
|||
.map(|s| s.as_str())
|
||||
.unwrap_or(" ");
|
||||
|
||||
let (x, _) = self.menu_content.write_string_to_grid(
|
||||
let (x, _) = self.menu_content.write_string(
|
||||
&if *account_settings!(
|
||||
context[self.accounts[aidx].hash]
|
||||
.listing
|
||||
|
@ -2846,7 +2846,7 @@ impl Listing {
|
|||
}
|
||||
}
|
||||
}
|
||||
let (x, _) = self.menu_content.write_string_to_grid(
|
||||
let (x, _) = self.menu_content.write_string(
|
||||
&branches,
|
||||
att.fg,
|
||||
att.bg,
|
||||
|
@ -2854,7 +2854,7 @@ impl Listing {
|
|||
((x, y), bottom_right),
|
||||
None,
|
||||
);
|
||||
let (x, _) = self.menu_content.write_string_to_grid(
|
||||
let (x, _) = self.menu_content.write_string(
|
||||
context.accounts[self.accounts[aidx].index].mailbox_entries[&l.mailbox_idx].name(),
|
||||
att.fg,
|
||||
att.bg,
|
||||
|
@ -2875,7 +2875,7 @@ impl Listing {
|
|||
(None, Some(coll)) => format!(" ({}) v", coll),
|
||||
};
|
||||
|
||||
let (x, _) = self.menu_content.write_string_to_grid(
|
||||
let (x, _) = self.menu_content.write_string(
|
||||
&count_string,
|
||||
unread_count_att.fg,
|
||||
unread_count_att.bg,
|
||||
|
|
|
@ -289,7 +289,7 @@ impl MailListingTrait for CompactListing {
|
|||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), 1, None, context);
|
||||
self.length = 0;
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
message.as_str(),
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
|
@ -582,7 +582,7 @@ impl MailListingTrait for CompactListing {
|
|||
let message: String = account[&self.cursor_pos.1].status();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), self.length + 1, None, context);
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
&message,
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
|
@ -1233,7 +1233,7 @@ impl CompactListing {
|
|||
columns[2].size().0,
|
||||
columns[3].size().0,
|
||||
);
|
||||
let (x, _) = columns[0].write_string_to_grid(
|
||||
let (x, _) = columns[0].write_string(
|
||||
&idx.to_string(),
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1244,7 +1244,7 @@ impl CompactListing {
|
|||
for c in columns[0].row_iter(x..min_width.0, idx) {
|
||||
columns[0][c].set_bg(row_attr.bg).set_ch(' ');
|
||||
}
|
||||
let (x, _) = columns[1].write_string_to_grid(
|
||||
let (x, _) = columns[1].write_string(
|
||||
&strings.date,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1255,7 +1255,7 @@ impl CompactListing {
|
|||
for c in columns[1].row_iter(x..min_width.1, idx) {
|
||||
columns[1][c].set_bg(row_attr.bg).set_ch(' ');
|
||||
}
|
||||
let (x, _) = columns[2].write_string_to_grid(
|
||||
let (x, _) = columns[2].write_string(
|
||||
&strings.from,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1266,7 +1266,7 @@ impl CompactListing {
|
|||
for c in columns[2].row_iter(x..min_width.2, idx) {
|
||||
columns[2][c].set_bg(row_attr.bg).set_ch(' ');
|
||||
}
|
||||
let (x, _) = columns[3].write_string_to_grid(
|
||||
let (x, _) = columns[3].write_string(
|
||||
&strings.flag,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1274,7 +1274,7 @@ impl CompactListing {
|
|||
((0, idx), (min_width.3, idx)),
|
||||
None,
|
||||
);
|
||||
let (x, _) = columns[3].write_string_to_grid(
|
||||
let (x, _) = columns[3].write_string(
|
||||
&strings.subject,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1289,7 +1289,7 @@ impl CompactListing {
|
|||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = columns[3].write_string_to_grid(
|
||||
let (_x, _) = columns[3].write_string(
|
||||
t,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
|
@ -1362,7 +1362,7 @@ impl CompactListing {
|
|||
panic!();
|
||||
}
|
||||
let row_attr = self.rows.row_attr_cache[&idx];
|
||||
let (x, _) = self.data_columns.columns[0].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[0].write_string(
|
||||
&idx.to_string(),
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1375,7 +1375,7 @@ impl CompactListing {
|
|||
.set_bg(row_attr.bg)
|
||||
.set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = self.data_columns.columns[1].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[1].write_string(
|
||||
&strings.date,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1388,7 +1388,7 @@ impl CompactListing {
|
|||
.set_bg(row_attr.bg)
|
||||
.set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = self.data_columns.columns[2].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[2].write_string(
|
||||
&strings.from,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1410,7 +1410,7 @@ impl CompactListing {
|
|||
.set_bg(row_attr.bg)
|
||||
.set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = self.data_columns.columns[3].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[3].write_string(
|
||||
&strings.flag,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1418,7 +1418,7 @@ impl CompactListing {
|
|||
((0, idx), (min_width.3, idx)),
|
||||
None,
|
||||
);
|
||||
let (x, _) = self.data_columns.columns[3].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[3].write_string(
|
||||
&strings.subject,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1439,7 +1439,7 @@ impl CompactListing {
|
|||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = self.data_columns.columns[3].write_string_to_grid(
|
||||
let (_x, _) = self.data_columns.columns[3].write_string(
|
||||
t,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
|
@ -1534,7 +1534,7 @@ impl Component for CompactListing {
|
|||
let mut area = area;
|
||||
if !self.filter_term.is_empty() {
|
||||
let (upper_left, bottom_right) = area;
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&format!(
|
||||
"{} results for `{}` (Press ESC to exit)",
|
||||
self.filtered_selection.len(),
|
||||
|
|
|
@ -465,7 +465,7 @@ impl ListingTrait for ConversationsListing {
|
|||
if let Err(message) = self.error.as_ref() {
|
||||
grid.clear_area(area, self.color_cache.theme_default);
|
||||
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
message,
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
|
@ -904,7 +904,7 @@ impl ConversationsListing {
|
|||
self.rows.is_thread_selected(*thread_hash)
|
||||
);
|
||||
/* draw flags */
|
||||
let (x, _) = grid.write_string_to_grid(
|
||||
let (x, _) = grid.write_string(
|
||||
&strings.flag,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -923,7 +923,7 @@ impl ConversationsListing {
|
|||
self.rows.is_thread_selected(*thread_hash)
|
||||
);
|
||||
/* draw subject */
|
||||
let (mut x, subject_overflowed) = grid.write_string_to_grid(
|
||||
let (mut x, subject_overflowed) = grid.write_string(
|
||||
&strings.subject,
|
||||
subject_attr.fg,
|
||||
subject_attr.bg,
|
||||
|
@ -937,7 +937,7 @@ impl ConversationsListing {
|
|||
break;
|
||||
};
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _y) = grid.write_string_to_grid(
|
||||
let (_x, _y) = grid.write_string(
|
||||
t,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
|
@ -981,7 +981,7 @@ impl ConversationsListing {
|
|||
return;
|
||||
}
|
||||
/* Next line, draw date */
|
||||
let (x, _) = grid.write_string_to_grid(
|
||||
let (x, _) = grid.write_string(
|
||||
&strings.date,
|
||||
date_attr.fg,
|
||||
date_attr.bg,
|
||||
|
@ -1003,7 +1003,7 @@ impl ConversationsListing {
|
|||
self.rows.is_thread_selected(*thread_hash)
|
||||
);
|
||||
/* draw from */
|
||||
let (x, _) = grid.write_string_to_grid(
|
||||
let (x, _) = grid.write_string(
|
||||
&strings.from,
|
||||
from_attr.fg,
|
||||
from_attr.bg,
|
||||
|
@ -1042,7 +1042,7 @@ impl Component for ConversationsListing {
|
|||
let mut area = area;
|
||||
|
||||
if !self.filter_term.is_empty() {
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&format!(
|
||||
"{} results for `{}` (Press ESC to exit)",
|
||||
self.filtered_selection.len(),
|
||||
|
|
|
@ -141,7 +141,7 @@ impl Component for OfflineListing {
|
|||
let error_message = conf::value(context, "error_message");
|
||||
grid.clear_area(area, theme_default);
|
||||
if let Err(err) = context.is_online(self.cursor_pos.0) {
|
||||
let (x, _) = grid.write_string_to_grid(
|
||||
let (x, _) = grid.write_string(
|
||||
"offline: ",
|
||||
error_message.fg,
|
||||
error_message.bg,
|
||||
|
@ -150,7 +150,7 @@ impl Component for OfflineListing {
|
|||
None,
|
||||
);
|
||||
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&err.to_string(),
|
||||
error_message.fg,
|
||||
error_message.bg,
|
||||
|
@ -159,7 +159,7 @@ impl Component for OfflineListing {
|
|||
Some(get_x(upper_left!(area))),
|
||||
);
|
||||
if let Some(msg) = self.messages.last() {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
msg,
|
||||
text_unfocused.fg,
|
||||
text_unfocused.bg,
|
||||
|
@ -169,7 +169,7 @@ impl Component for OfflineListing {
|
|||
);
|
||||
}
|
||||
for (i, msg) in self.messages.iter().rev().skip(1).enumerate() {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
msg,
|
||||
text_unfocused.fg,
|
||||
text_unfocused.bg,
|
||||
|
@ -179,7 +179,7 @@ impl Component for OfflineListing {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
let (_, mut y) = grid.write_string_to_grid(
|
||||
let (_, mut y) = grid.write_string(
|
||||
"loading...",
|
||||
conf::value(context, "highlight").fg,
|
||||
conf::value(context, "highlight").bg,
|
||||
|
@ -193,7 +193,7 @@ impl Component for OfflineListing {
|
|||
.collect();
|
||||
jobs.sort_by_key(|(j, _)| *j);
|
||||
for (job_id, j) in jobs {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!("{}: {:?}", job_id, j),
|
||||
text_unfocused.fg,
|
||||
text_unfocused.bg,
|
||||
|
|
|
@ -232,7 +232,7 @@ impl MailListingTrait for PlainListing {
|
|||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), 1, None, context);
|
||||
self.length = 0;
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
message.as_str(),
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
|
@ -917,7 +917,7 @@ impl PlainListing {
|
|||
|
||||
let row_attr = self.rows.row_attr_cache[&idx];
|
||||
|
||||
let (x, _) = columns[0].write_string_to_grid(
|
||||
let (x, _) = columns[0].write_string(
|
||||
&idx.to_string(),
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -928,7 +928,7 @@ impl PlainListing {
|
|||
for c in columns[0].row_iter(x..min_width.0, idx) {
|
||||
columns[0][c].set_bg(row_attr.bg).set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = columns[1].write_string_to_grid(
|
||||
let (x, _) = columns[1].write_string(
|
||||
&strings.date,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -939,7 +939,7 @@ impl PlainListing {
|
|||
for c in columns[1].row_iter(x..min_width.1, idx) {
|
||||
columns[1][c].set_bg(row_attr.bg).set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = columns[2].write_string_to_grid(
|
||||
let (x, _) = columns[2].write_string(
|
||||
&strings.from,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -950,7 +950,7 @@ impl PlainListing {
|
|||
for c in columns[2].row_iter(x..min_width.2, idx) {
|
||||
columns[2][c].set_bg(row_attr.bg).set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = columns[3].write_string_to_grid(
|
||||
let (x, _) = columns[3].write_string(
|
||||
&strings.flag,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -958,7 +958,7 @@ impl PlainListing {
|
|||
((0, idx), (min_width.3, idx)),
|
||||
None,
|
||||
);
|
||||
let (x, _) = columns[3].write_string_to_grid(
|
||||
let (x, _) = columns[3].write_string(
|
||||
&strings.subject,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -970,7 +970,7 @@ impl PlainListing {
|
|||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = columns[3].write_string_to_grid(
|
||||
let (_x, _) = columns[3].write_string(
|
||||
t,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
|
@ -1002,7 +1002,7 @@ impl PlainListing {
|
|||
let message: String = account[&self.cursor_pos.1].status();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), self.length + 1, None, context);
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
&message,
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
|
@ -1056,7 +1056,7 @@ impl PlainListing {
|
|||
columns[2].clear_area(((0, idx), (min_width.2, idx)), row_attr);
|
||||
columns[3].clear_area(((0, idx), (min_width.3, idx)), row_attr);
|
||||
|
||||
let (x, _) = columns[0].write_string_to_grid(
|
||||
let (x, _) = columns[0].write_string(
|
||||
&idx.to_string(),
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1067,7 +1067,7 @@ impl PlainListing {
|
|||
for c in columns[0].row_iter(x..min_width.0, idx) {
|
||||
columns[0][c].set_bg(row_attr.bg).set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = columns[1].write_string_to_grid(
|
||||
let (x, _) = columns[1].write_string(
|
||||
&strings.date,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1078,7 +1078,7 @@ impl PlainListing {
|
|||
for c in columns[1].row_iter(x..min_width.1, idx) {
|
||||
columns[1][c].set_bg(row_attr.bg).set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = columns[2].write_string_to_grid(
|
||||
let (x, _) = columns[2].write_string(
|
||||
&strings.from,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1089,7 +1089,7 @@ impl PlainListing {
|
|||
for c in columns[2].row_iter(x..min_width.2, idx) {
|
||||
columns[2][c].set_bg(row_attr.bg).set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = columns[3].write_string_to_grid(
|
||||
let (x, _) = columns[3].write_string(
|
||||
&strings.flag,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1097,7 +1097,7 @@ impl PlainListing {
|
|||
((0, idx), (min_width.3, idx)),
|
||||
None,
|
||||
);
|
||||
let (x, _) = columns[3].write_string_to_grid(
|
||||
let (x, _) = columns[3].write_string(
|
||||
&strings.subject,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1109,7 +1109,7 @@ impl PlainListing {
|
|||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = columns[3].write_string_to_grid(
|
||||
let (_x, _) = columns[3].write_string(
|
||||
t,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
|
@ -1155,7 +1155,7 @@ impl Component for PlainListing {
|
|||
let mut area = area;
|
||||
if !self.filter_term.is_empty() {
|
||||
let (upper_left, bottom_right) = area;
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&format!(
|
||||
"{} results for `{}` (Press ESC to exit)",
|
||||
self.filtered_selection.len(),
|
||||
|
|
|
@ -218,7 +218,7 @@ impl MailListingTrait for ThreadListing {
|
|||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), 1, None, context);
|
||||
self.length = 0;
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
message.as_str(),
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
|
@ -258,7 +258,7 @@ impl MailListingTrait for ThreadListing {
|
|||
let message: String = account[&self.cursor_pos.1].status();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), 1, None, context);
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
message.as_str(),
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
|
@ -947,7 +947,7 @@ impl ThreadListing {
|
|||
self.rows.selection[env_hash]
|
||||
);
|
||||
if !*account_settings!(context[self.cursor_pos.0].listing.relative_list_indices) {
|
||||
let (x, _) = self.data_columns.columns[0].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[0].write_string(
|
||||
&idx.to_string(),
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -961,7 +961,7 @@ impl ThreadListing {
|
|||
.set_attrs(row_attr.attrs);
|
||||
}
|
||||
}
|
||||
let (x, _) = self.data_columns.columns[1].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[1].write_string(
|
||||
&strings.date,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -974,7 +974,7 @@ impl ThreadListing {
|
|||
.set_bg(row_attr.bg)
|
||||
.set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = self.data_columns.columns[2].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[2].write_string(
|
||||
&strings.from,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -996,7 +996,7 @@ impl ThreadListing {
|
|||
.set_bg(row_attr.bg)
|
||||
.set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = self.data_columns.columns[3].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[3].write_string(
|
||||
&strings.flag,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1009,7 +1009,7 @@ impl ThreadListing {
|
|||
.set_bg(row_attr.bg)
|
||||
.set_attrs(row_attr.attrs);
|
||||
}
|
||||
let (x, _) = self.data_columns.columns[4].write_string_to_grid(
|
||||
let (x, _) = self.data_columns.columns[4].write_string(
|
||||
&strings.subject,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
|
@ -1030,7 +1030,7 @@ impl ThreadListing {
|
|||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = self.data_columns.columns[4].write_string_to_grid(
|
||||
let (_x, _) = self.data_columns.columns[4].write_string(
|
||||
t,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
|
@ -1133,7 +1133,7 @@ impl ThreadListing {
|
|||
),
|
||||
row_attr,
|
||||
);
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
&if self.new_cursor_pos.2.saturating_sub(top_idx) == i {
|
||||
self.new_cursor_pos.2.to_string()
|
||||
} else {
|
||||
|
@ -1148,7 +1148,7 @@ impl ThreadListing {
|
|||
None,
|
||||
);
|
||||
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&if self.new_cursor_pos.2.saturating_sub(top_idx) == i {
|
||||
self.new_cursor_pos.2.to_string()
|
||||
} else {
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Component for AccountStatus {
|
|||
self.dirty = false;
|
||||
let (mut width, _) = self.content.size();
|
||||
let a = &context.accounts[self.account_pos];
|
||||
let (_x, _y) = self.content.write_string_to_grid(
|
||||
let (_x, _y) = self.content.write_string(
|
||||
"Account ",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -78,7 +78,7 @@ impl Component for AccountStatus {
|
|||
((1, 0), (width - 1, 0)),
|
||||
None,
|
||||
);
|
||||
let (_x, _y) = self.content.write_string_to_grid(
|
||||
let (_x, _y) = self.content.write_string(
|
||||
a.name(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -89,7 +89,7 @@ impl Component for AccountStatus {
|
|||
width = self.content.size().0;
|
||||
let mut line = 2;
|
||||
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
"In-progress jobs:",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -102,7 +102,7 @@ impl Component for AccountStatus {
|
|||
for (job_id, req) in a.active_jobs.iter() {
|
||||
width = self.content.size().0;
|
||||
use crate::accounts::JobRequest;
|
||||
let (x, y) = self.content.write_string_to_grid(
|
||||
let (x, y) = self.content.write_string(
|
||||
&format!("{} {}", req, job_id),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -116,7 +116,7 @@ impl Component for AccountStatus {
|
|||
| JobRequest::Refresh { mailbox_hash, .. }
|
||||
| JobRequest::Fetch { mailbox_hash, .. } = req
|
||||
{
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
a.mailbox_entries[mailbox_hash].name(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -132,7 +132,7 @@ impl Component for AccountStatus {
|
|||
line += 2;
|
||||
width = self.content.size().0;
|
||||
|
||||
let (_x, _y) = self.content.write_string_to_grid(
|
||||
let (_x, _y) = self.content.write_string(
|
||||
"Tag support: ",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -141,7 +141,7 @@ impl Component for AccountStatus {
|
|||
None,
|
||||
);
|
||||
width = self.content.size().0;
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
if a.backend_capabilities.supports_tags {
|
||||
"yes"
|
||||
} else {
|
||||
|
@ -155,7 +155,7 @@ impl Component for AccountStatus {
|
|||
);
|
||||
width = self.content.size().0;
|
||||
line += 1;
|
||||
let (_x, _y) = self.content.write_string_to_grid(
|
||||
let (_x, _y) = self.content.write_string(
|
||||
"Search backend: ",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -164,7 +164,7 @@ impl Component for AccountStatus {
|
|||
None,
|
||||
);
|
||||
width = self.content.size().0;
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
&match (
|
||||
a.settings.conf.search_backend(),
|
||||
a.backend_capabilities.supports_search,
|
||||
|
@ -193,7 +193,7 @@ impl Component for AccountStatus {
|
|||
width = self.content.size().0;
|
||||
line += 1;
|
||||
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
"Special Mailboxes:",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -209,7 +209,7 @@ impl Component for AccountStatus {
|
|||
{
|
||||
width = self.content.size().0;
|
||||
line += 1;
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
&format!("{}: {}", f.path(), f.special_usage()),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -220,7 +220,7 @@ impl Component for AccountStatus {
|
|||
}
|
||||
line += 2;
|
||||
width = self.content.size().0;
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
"Subscribed mailboxes:",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -233,7 +233,7 @@ impl Component for AccountStatus {
|
|||
width = self.content.size().0;
|
||||
let f: &Mailbox = &a[&mailbox_node.hash].ref_mailbox;
|
||||
if f.is_subscribed() {
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
f.path(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -248,7 +248,7 @@ impl Component for AccountStatus {
|
|||
line += 1;
|
||||
width = self.content.size().0;
|
||||
if let Some(ref extensions) = a.backend_capabilities.extensions {
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
"Server Extensions:",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -265,7 +265,7 @@ impl Component for AccountStatus {
|
|||
.unwrap_or(0),
|
||||
);
|
||||
width = self.content.size().0;
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
"meli support:",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -276,7 +276,7 @@ impl Component for AccountStatus {
|
|||
line += 1;
|
||||
for (name, status) in extensions.iter() {
|
||||
width = self.content.size().0;
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
name.trim_at_boundary(30),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -298,7 +298,7 @@ impl Component for AccountStatus {
|
|||
("enabled", Color::Green)
|
||||
}
|
||||
};
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
status,
|
||||
color,
|
||||
self.theme_default.bg,
|
||||
|
@ -312,7 +312,7 @@ impl Component for AccountStatus {
|
|||
| MailBackendExtensionStatus::Supported { comment }
|
||||
| MailBackendExtensionStatus::Enabled { comment } => {
|
||||
if let Some(s) = comment {
|
||||
let (x, y) = self.content.write_string_to_grid(
|
||||
let (x, y) = self.content.write_string(
|
||||
" (",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -320,7 +320,7 @@ impl Component for AccountStatus {
|
|||
((x, y), (width - 1, y)),
|
||||
None,
|
||||
);
|
||||
let (x, y) = self.content.write_string_to_grid(
|
||||
let (x, y) = self.content.write_string(
|
||||
s,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -328,7 +328,7 @@ impl Component for AccountStatus {
|
|||
((x, y), (width - 1, y)),
|
||||
None,
|
||||
);
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
")",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -343,7 +343,7 @@ impl Component for AccountStatus {
|
|||
}
|
||||
}
|
||||
|
||||
/* self.content may have been resized with write_string_to_grid() calls above
|
||||
/* self.content may have been resized with write_string() calls above
|
||||
* since it has growable set */
|
||||
let (width, height) = self.content.size();
|
||||
let (cols, rows) = (width!(area), height!(area));
|
||||
|
|
|
@ -743,7 +743,7 @@ impl Component for EnvelopeView {
|
|||
if sticky || skip_header_ctr == 0 {
|
||||
if y <= get_y(bottom_right) {
|
||||
let (_x, _y) =
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!("{}:", $header),
|
||||
headers_names.fg,
|
||||
headers_names.bg,
|
||||
|
@ -759,7 +759,7 @@ impl Component for EnvelopeView {
|
|||
}
|
||||
|
||||
let (_x, _y) =
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&$string,
|
||||
headers.fg,
|
||||
headers.bg,
|
||||
|
@ -878,7 +878,7 @@ impl Component for EnvelopeView {
|
|||
(set_y(upper_left, y), set_y(bottom_right, y)),
|
||||
headers_area,
|
||||
);
|
||||
let (_x, _) = grid.write_string_to_grid(
|
||||
let (_x, _) = grid.write_string(
|
||||
"List-ID: ",
|
||||
headers_names.fg,
|
||||
headers_names.bg,
|
||||
|
@ -886,7 +886,7 @@ impl Component for EnvelopeView {
|
|||
(set_y(upper_left, y), bottom_right),
|
||||
None,
|
||||
);
|
||||
let (_x, _y) = grid.write_string_to_grid(
|
||||
let (_x, _y) = grid.write_string(
|
||||
id,
|
||||
headers.fg,
|
||||
headers.bg,
|
||||
|
@ -904,7 +904,7 @@ impl Component for EnvelopeView {
|
|||
}
|
||||
if sticky || skip_header_ctr == 0 {
|
||||
if archive.is_some() || post.is_some() || unsubscribe.is_some() {
|
||||
let (_x, _y) = grid.write_string_to_grid(
|
||||
let (_x, _y) = grid.write_string(
|
||||
" Available actions: [ ",
|
||||
headers_names.fg,
|
||||
headers_names.bg,
|
||||
|
@ -916,7 +916,7 @@ impl Component for EnvelopeView {
|
|||
y = _y;
|
||||
}
|
||||
if archive.is_some() {
|
||||
let (_x, _y) = grid.write_string_to_grid(
|
||||
let (_x, _y) = grid.write_string(
|
||||
"list-archive, ",
|
||||
headers.fg,
|
||||
headers.bg,
|
||||
|
@ -928,7 +928,7 @@ impl Component for EnvelopeView {
|
|||
y = _y;
|
||||
}
|
||||
if post.is_some() {
|
||||
let (_x, _y) = grid.write_string_to_grid(
|
||||
let (_x, _y) = grid.write_string(
|
||||
"list-post, ",
|
||||
headers.fg,
|
||||
headers.bg,
|
||||
|
@ -940,7 +940,7 @@ impl Component for EnvelopeView {
|
|||
y = _y;
|
||||
}
|
||||
if unsubscribe.is_some() {
|
||||
let (_x, _y) = grid.write_string_to_grid(
|
||||
let (_x, _y) = grid.write_string(
|
||||
"list-unsubscribe, ",
|
||||
headers.fg,
|
||||
headers.bg,
|
||||
|
@ -1237,7 +1237,7 @@ impl Component for EnvelopeView {
|
|||
} else {
|
||||
let s = self.cmd_buf.to_string();
|
||||
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&s,
|
||||
self.view_settings.theme_default.fg,
|
||||
self.view_settings.theme_default.bg,
|
||||
|
|
|
@ -377,7 +377,7 @@ impl ThreadView {
|
|||
set_and_join_box(&mut content, index, BoxBoundary::Horizontal);
|
||||
}
|
||||
}
|
||||
content.write_string_to_grid(
|
||||
content.write_string(
|
||||
&e.heading,
|
||||
if e.seen {
|
||||
theme_default.fg
|
||||
|
@ -443,7 +443,7 @@ impl ThreadView {
|
|||
set_and_join_box(&mut content, index, BoxBoundary::Horizontal);
|
||||
}
|
||||
}
|
||||
content.write_string_to_grid(
|
||||
content.write_string(
|
||||
&e.heading,
|
||||
if e.seen {
|
||||
theme_default.fg
|
||||
|
@ -751,7 +751,7 @@ impl ThreadView {
|
|||
});
|
||||
let envelope: EnvelopeRef = account.collection.get_env(i);
|
||||
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&envelope.subject(),
|
||||
crate::conf::value(context, "highlight").fg,
|
||||
theme_default.bg,
|
||||
|
@ -863,7 +863,7 @@ impl ThreadView {
|
|||
});
|
||||
let envelope: EnvelopeRef = account.collection.get_env(i);
|
||||
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&envelope.subject(),
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
|
|
|
@ -130,7 +130,7 @@ impl MailboxManager {
|
|||
CellBuffer::new_with_context(min_width.3, self.length, None, context);
|
||||
|
||||
for (idx, e) in self.entries.values().enumerate() {
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
e.name(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -139,7 +139,7 @@ impl MailboxManager {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[1].write_string_to_grid(
|
||||
self.data_columns.columns[1].write_string(
|
||||
e.ref_mailbox.path(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -149,7 +149,7 @@ impl MailboxManager {
|
|||
);
|
||||
|
||||
let (_unseen, total) = e.ref_mailbox.count().ok().unwrap_or((0, 0));
|
||||
self.data_columns.columns[2].write_string_to_grid(
|
||||
self.data_columns.columns[2].write_string(
|
||||
&total.to_string(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -158,7 +158,7 @@ impl MailboxManager {
|
|||
None,
|
||||
);
|
||||
|
||||
self.data_columns.columns[3].write_string_to_grid(
|
||||
self.data_columns.columns[3].write_string(
|
||||
if e.ref_mailbox.is_subscribed() {
|
||||
"yes"
|
||||
} else {
|
||||
|
@ -176,7 +176,7 @@ impl MailboxManager {
|
|||
let message = "No mailboxes.".to_string();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), self.length, None, context);
|
||||
self.data_columns.columns[0].write_string_to_grid(
|
||||
self.data_columns.columns[0].write_string(
|
||||
&message,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
|
|
@ -709,7 +709,7 @@ impl State {
|
|||
.chain(Some(String::new()))
|
||||
.chain(Some(datetime::timestamp_to_string(*timestamp, None, false)))
|
||||
{
|
||||
self.screen.overlay_grid.write_string_to_grid(
|
||||
self.screen.overlay_grid.write_string(
|
||||
&line,
|
||||
noto_colors.fg,
|
||||
noto_colors.bg,
|
||||
|
@ -721,7 +721,7 @@ impl State {
|
|||
}
|
||||
|
||||
if self.display_messages.len() > 1 {
|
||||
self.screen.overlay_grid.write_string_to_grid(
|
||||
self.screen.overlay_grid.write_string(
|
||||
&if self.display_messages_pos == 0 {
|
||||
format!(
|
||||
"Next: {}",
|
||||
|
|
|
@ -437,7 +437,7 @@ impl CellBuffer {
|
|||
|
||||
/// Write an `&str` to a `CellBuffer` in a specified `Area` with the passed
|
||||
/// colors.
|
||||
pub fn write_string_to_grid(
|
||||
pub fn write_string(
|
||||
&mut self,
|
||||
s: &str,
|
||||
fg_color: Color,
|
||||
|
@ -1847,7 +1847,7 @@ mod tests {
|
|||
);
|
||||
let width = buf.size().0;
|
||||
for (i, l) in lines.iter().enumerate() {
|
||||
buf.write_string_to_grid(
|
||||
buf.write_string(
|
||||
l,
|
||||
Color::Default,
|
||||
Color::Default,
|
||||
|
|
|
@ -131,7 +131,7 @@ impl StatusBar {
|
|||
if !context.settings.terminal.use_color() {
|
||||
attribute.attrs |= Attr::REVERSE;
|
||||
}
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&self.status,
|
||||
attribute.fg,
|
||||
attribute.bg,
|
||||
|
@ -174,7 +174,7 @@ impl StatusBar {
|
|||
total_lines = *total_lines,
|
||||
has_more_lines = if *has_more_lines { "(+)" } else { "" }
|
||||
);
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&s,
|
||||
attribute.fg,
|
||||
attribute.bg,
|
||||
|
@ -236,7 +236,7 @@ impl StatusBar {
|
|||
fn draw_command_bar(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
grid.clear_area(area, crate::conf::value(context, "theme_default"));
|
||||
let command_bar = crate::conf::value(context, "status.command_bar");
|
||||
let (_, y) = grid.write_string_to_grid(
|
||||
let (_, y) = grid.write_string(
|
||||
self.ex_buffer.as_str(),
|
||||
command_bar.fg,
|
||||
command_bar.bg,
|
||||
|
@ -429,7 +429,7 @@ impl Component for StatusBar {
|
|||
.take(hist_height)
|
||||
.enumerate()
|
||||
{
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
s.as_str(),
|
||||
history_hints.fg,
|
||||
history_hints.bg,
|
||||
|
@ -443,7 +443,7 @@ impl Component for StatusBar {
|
|||
),
|
||||
Some(get_x(upper_left!(hist_area))),
|
||||
);
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&s.description,
|
||||
history_hints.fg,
|
||||
history_hints.bg,
|
||||
|
@ -465,7 +465,7 @@ impl Component for StatusBar {
|
|||
),
|
||||
history_hints,
|
||||
);
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&s.as_str()[self.ex_buffer.as_str().len()..],
|
||||
history_hints.fg,
|
||||
history_hints.bg,
|
||||
|
@ -865,7 +865,7 @@ impl Tabbed {
|
|||
} else {
|
||||
tab_unfocused_attribute
|
||||
};
|
||||
let (x_, _y_) = grid.write_string_to_grid(
|
||||
let (x_, _y_) = grid.write_string(
|
||||
&format!(" {} ", c),
|
||||
fg,
|
||||
bg,
|
||||
|
@ -1007,7 +1007,7 @@ impl Component for Tabbed {
|
|||
context.dirty_areas.push_back(dialog_area);
|
||||
grid.clear_area(dialog_area, self.theme_default);
|
||||
let inner_area = create_box(grid, dialog_area);
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
"shortcuts",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -1018,7 +1018,7 @@ impl Component for Tabbed {
|
|||
),
|
||||
None,
|
||||
);
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!(
|
||||
"Press {} to close",
|
||||
children_maps[Shortcuts::GENERAL]["toggle_help"]
|
||||
|
@ -1126,7 +1126,7 @@ impl Component for Tabbed {
|
|||
self.help_content =
|
||||
CellBuffer::new_with_context(max_width, max_length + 2, None, context);
|
||||
self.help_content.set_growable(true);
|
||||
self.help_content.write_string_to_grid(
|
||||
self.help_content.write_string(
|
||||
"use COMMAND \"search\" to find shortcuts",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -1136,7 +1136,7 @@ impl Component for Tabbed {
|
|||
);
|
||||
let mut idx = 2;
|
||||
for (desc, shortcuts) in children_maps.iter() {
|
||||
self.help_content.write_string_to_grid(
|
||||
self.help_content.write_string(
|
||||
desc,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -1146,7 +1146,7 @@ impl Component for Tabbed {
|
|||
);
|
||||
idx += 2;
|
||||
for (k, v) in shortcuts {
|
||||
let (x, y) = self.help_content.write_string_to_grid(
|
||||
let (x, y) = self.help_content.write_string(
|
||||
&format!(
|
||||
"{: >width$}",
|
||||
format!("{}", v),
|
||||
|
@ -1158,7 +1158,7 @@ impl Component for Tabbed {
|
|||
((2, 2 + idx), (max_width.saturating_sub(2), max_length - 1)),
|
||||
None,
|
||||
);
|
||||
self.help_content.write_string_to_grid(
|
||||
self.help_content.write_string(
|
||||
k,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -1183,7 +1183,7 @@ impl Component for Tabbed {
|
|||
context.dirty_areas.push_back(dialog_area);
|
||||
grid.clear_area(dialog_area, self.theme_default);
|
||||
let inner_area = create_box(grid, dialog_area);
|
||||
let (x, y) = grid.write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
"shortcuts",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -1194,7 +1194,7 @@ impl Component for Tabbed {
|
|||
),
|
||||
None,
|
||||
);
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!(
|
||||
"Press {} to close",
|
||||
self.help_curr_views[Shortcuts::GENERAL]["toggle_help"]
|
||||
|
@ -1279,7 +1279,7 @@ impl Component for Tabbed {
|
|||
|
||||
/* In this case we will be scrolling, so show the user how to do it */
|
||||
if height.wrapping_div(rows + 1) > 0 || width.wrapping_div(cols + 1) > 0 {
|
||||
self.help_content.write_string_to_grid(
|
||||
self.help_content.write_string(
|
||||
"Use Up, Down, Left, Right to scroll.",
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
|
|
@ -135,7 +135,7 @@ impl<T: 'static + PartialEq + std::fmt::Debug + Clone + Sync + Send> Component f
|
|||
* cursor */
|
||||
self.entries[c].1 = !self.entries[c].1;
|
||||
if self.entries[c].1 {
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
"x",
|
||||
highlighted_attrs.fg,
|
||||
highlighted_attrs.bg,
|
||||
|
@ -144,7 +144,7 @@ impl<T: 'static + PartialEq + std::fmt::Debug + Clone + Sync + Send> Component f
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
" ",
|
||||
highlighted_attrs.fg,
|
||||
highlighted_attrs.bg,
|
||||
|
@ -460,7 +460,7 @@ impl Component for UIConfirmationDialog {
|
|||
* cursor */
|
||||
self.entries[c].1 = !self.entries[c].1;
|
||||
if self.entries[c].1 {
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
"x",
|
||||
highlighted_attrs.fg,
|
||||
highlighted_attrs.bg,
|
||||
|
@ -469,7 +469,7 @@ impl Component for UIConfirmationDialog {
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
self.content.write_string_to_grid(
|
||||
self.content.write_string(
|
||||
" ",
|
||||
highlighted_attrs.fg,
|
||||
highlighted_attrs.bg,
|
||||
|
@ -815,7 +815,7 @@ impl<T: PartialEq + std::fmt::Debug + Clone + Sync + Send, F: 'static + Sync + S
|
|||
let mut content = CellBuffer::new_with_context(width, height, None, context);
|
||||
if self.single_only {
|
||||
for (i, e) in self.entry_titles.iter().enumerate() {
|
||||
content.write_string_to_grid(
|
||||
content.write_string(
|
||||
e,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -826,7 +826,7 @@ impl<T: PartialEq + std::fmt::Debug + Clone + Sync + Send, F: 'static + Sync + S
|
|||
}
|
||||
} else {
|
||||
for (i, e) in self.entry_titles.iter().enumerate() {
|
||||
content.write_string_to_grid(
|
||||
content.write_string(
|
||||
&format!("[ ] {}", e),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -835,7 +835,7 @@ impl<T: PartialEq + std::fmt::Debug + Clone + Sync + Send, F: 'static + Sync + S
|
|||
None,
|
||||
);
|
||||
}
|
||||
content.write_string_to_grid(
|
||||
content.write_string(
|
||||
OK_CANCEL,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -887,7 +887,7 @@ impl<T: PartialEq + std::fmt::Debug + Clone + Sync + Send, F: 'static + Sync + S
|
|||
let inner_area = create_box(grid, dialog_area);
|
||||
grid.clear_area(inner_area, self.theme_default);
|
||||
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&self.title,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
@ -899,7 +899,7 @@ impl<T: PartialEq + std::fmt::Debug + Clone + Sync + Send, F: 'static + Sync + S
|
|||
None,
|
||||
);
|
||||
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
&navigate_help_string,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
|
|
|
@ -353,7 +353,7 @@ impl Pager {
|
|||
.skip(self.cursor.1)
|
||||
.take(height!(area))
|
||||
{
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
l,
|
||||
self.colors.fg,
|
||||
self.colors.bg,
|
||||
|
@ -635,7 +635,7 @@ impl Component for Pager {
|
|||
if !context.settings.terminal.use_color() {
|
||||
attribute.attrs |= Attr::REVERSE;
|
||||
}
|
||||
let (_, y) = grid.write_string_to_grid(
|
||||
let (_, y) = grid.write_string(
|
||||
&status_message,
|
||||
attribute.fg,
|
||||
attribute.bg,
|
||||
|
|
|
@ -171,7 +171,7 @@ impl Component for TextField {
|
|||
* ⇧+⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧++⇧⇧⇧⇧⇧⇧⇧⇧⇧⇧
|
||||
* skip offset
|
||||
*/
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
if width < self.inner.grapheme_pos() {
|
||||
str.trim_left_at_boundary(
|
||||
width
|
||||
|
|
|
@ -118,7 +118,7 @@ impl Component for Field {
|
|||
text_field.draw(grid, area, context);
|
||||
}
|
||||
Self::Choice(_, _, _) => {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
str,
|
||||
theme_attr.fg,
|
||||
theme_attr.bg,
|
||||
|
@ -365,7 +365,7 @@ impl<T: 'static + std::fmt::Debug + Copy + Default + Send + Sync> Component for
|
|||
for (i, k) in self.layout.iter().enumerate().rev() {
|
||||
let v = self.fields.get_mut(k).unwrap();
|
||||
/* Write field label */
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
k.as_ref(),
|
||||
label_attrs.fg,
|
||||
label_attrs.bg,
|
||||
|
@ -651,7 +651,7 @@ where
|
|||
let mut len = 0;
|
||||
for (i, k) in self.layout.iter().enumerate() {
|
||||
let cur_len = k.len();
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
k.as_ref(),
|
||||
theme_default.fg,
|
||||
if i == self.cursor && self.focus {
|
||||
|
@ -875,7 +875,7 @@ impl AutoComplete {
|
|||
);
|
||||
let width = content.cols();
|
||||
for (i, e) in entries.iter().enumerate() {
|
||||
let (x, _) = content.write_string_to_grid(
|
||||
let (x, _) = content.write_string(
|
||||
&e.entry,
|
||||
Color::Byte(23),
|
||||
Color::Byte(7),
|
||||
|
@ -883,7 +883,7 @@ impl AutoComplete {
|
|||
((0, i), (width - 1, i)),
|
||||
None,
|
||||
);
|
||||
content.write_string_to_grid(
|
||||
content.write_string(
|
||||
&e.description,
|
||||
Color::Byte(23),
|
||||
Color::Byte(7),
|
||||
|
@ -891,7 +891,7 @@ impl AutoComplete {
|
|||
((x + 2, i), (width - 1, i)),
|
||||
None,
|
||||
);
|
||||
content.write_string_to_grid(
|
||||
content.write_string(
|
||||
"▒",
|
||||
Color::Byte(23),
|
||||
Color::Byte(7),
|
||||
|
@ -1239,7 +1239,7 @@ impl Component for ProgressSpinner {
|
|||
if self.dirty {
|
||||
grid.clear_area(area, self.theme_attr);
|
||||
if self.active {
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
match self.kind.as_ref() {
|
||||
Ok(kind) => (Self::KINDS[*kind].1)[self.stage],
|
||||
Err(custom) => custom[self.stage].as_ref(),
|
||||
|
|
|
@ -179,7 +179,7 @@ impl Component for EmbedContainer {
|
|||
.iter()
|
||||
.enumerate()
|
||||
{
|
||||
grid.write_string_to_grid(
|
||||
grid.write_string(
|
||||
l,
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
|
|
Loading…
Reference in New Issue