ui: view: small fixes

embed
Manos Pitsidianakis 2019-05-01 13:55:12 +03:00
parent 13cd6b2741
commit 9143b2e791
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
2 changed files with 108 additions and 103 deletions

View File

@ -255,9 +255,13 @@ impl MailView {
impl Component for MailView {
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
if !self.is_dirty() {
return;
}
let upper_left = upper_left!(area);
let bottom_right = bottom_right!(area);
if self.dirty {
let y: usize = {
let accounts = &mut context.accounts;
let mailbox = &mut accounts[self.coordinates.0][self.coordinates.1]
@ -348,7 +352,6 @@ impl Component for MailView {
}
};
if self.dirty {
let body = {
let mailbox_idx = self.coordinates; // coordinates are mailbox idxs
let mailbox = &context.accounts[mailbox_idx.0][mailbox_idx.1]
@ -404,7 +407,6 @@ impl Component for MailView {
}
};
self.dirty = false;
}
match self.mode {
ViewMode::Subview => {
@ -423,6 +425,7 @@ impl Component for MailView {
}
}
}
}
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
match self.mode {
@ -671,7 +674,6 @@ impl Component for MailView {
}
UIEvent::EnvelopeRename(_, old_hash, new_hash) if old_hash == self.coordinates.2 => {
self.coordinates.2 = new_hash;
self.set_dirty();
}
_ => {
return false;

View File

@ -428,6 +428,9 @@ impl ThreadView {
.flat_map(|ref v| v.iter())
.collect();
self.cursor_pos = self.new_cursor_pos;
if self.cursor_pos + 1 > visibles.len() {
self.cursor_pos = visibles.len().saturating_sub(1);
}
let idx = *visibles[self.cursor_pos];
let src_area = { get_entry_area(idx, &self.entries) };
let visual_indentation = self.entries[idx].indentation * 4;