ui: add PageMovements in ThreadListing
parent
831ec97d64
commit
6088705745
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use components::utilities::PageMovement;
|
||||||
|
|
||||||
const MAX_COLS: usize = 500;
|
const MAX_COLS: usize = 500;
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ pub struct ThreadListing {
|
||||||
locations: Vec<EnvelopeHash>,
|
locations: Vec<EnvelopeHash>,
|
||||||
/// If we must redraw on next redraw event
|
/// If we must redraw on next redraw event
|
||||||
dirty: bool,
|
dirty: bool,
|
||||||
/// If `self.view` exists or not.
|
/// If `self.view` is focused or not.
|
||||||
unfocused: bool,
|
unfocused: bool,
|
||||||
initialised: bool,
|
initialised: bool,
|
||||||
view: Option<MailView>,
|
view: Option<MailView>,
|
||||||
|
@ -131,7 +132,8 @@ impl ThreadListing {
|
||||||
let account = &context.accounts[self.cursor_pos.0];
|
let account = &context.accounts[self.cursor_pos.0];
|
||||||
let mailbox = account[self.cursor_pos.1].as_ref().unwrap();
|
let mailbox = account[self.cursor_pos.1].as_ref().unwrap();
|
||||||
|
|
||||||
self.length = account.collection.threads.len();
|
let threads = &account.collection.threads[&mailbox.folder.hash()];
|
||||||
|
self.length = threads.len();
|
||||||
self.content = CellBuffer::new(MAX_COLS, self.length + 1, Cell::with_char(' '));
|
self.content = CellBuffer::new(MAX_COLS, self.length + 1, Cell::with_char(' '));
|
||||||
self.locations.clear();
|
self.locations.clear();
|
||||||
if self.length == 0 {
|
if self.length == 0 {
|
||||||
|
@ -149,7 +151,6 @@ impl ThreadListing {
|
||||||
let mut indentations: Vec<bool> = Vec::with_capacity(6);
|
let mut indentations: Vec<bool> = Vec::with_capacity(6);
|
||||||
let mut thread_idx = 0; // needed for alternate thread colors
|
let mut thread_idx = 0; // needed for alternate thread colors
|
||||||
/* Draw threaded view. */
|
/* Draw threaded view. */
|
||||||
let threads = &account.collection.threads[&mailbox.folder.hash()];
|
|
||||||
threads.sort_by(self.sort, self.subsort, &account.collection);
|
threads.sort_by(self.sort, self.subsort, &account.collection);
|
||||||
let thread_nodes: &FnvHashMap<ThreadHash, ThreadNode> = &threads.thread_nodes();
|
let thread_nodes: &FnvHashMap<ThreadHash, ThreadNode> = &threads.thread_nodes();
|
||||||
let mut iter = threads.threads_iter().peekable();
|
let mut iter = threads.threads_iter().peekable();
|
||||||
|
@ -529,7 +530,12 @@ impl Component for ThreadListing {
|
||||||
self.locations[self.cursor_pos.2],
|
self.locations[self.cursor_pos.2],
|
||||||
);
|
);
|
||||||
|
|
||||||
self.view = Some(MailView::new(coordinates, None, None, context));
|
if let Some(ref mut v) = self.view {
|
||||||
|
v.update(coordinates);
|
||||||
|
} else {
|
||||||
|
self.view = Some(MailView::new(coordinates, None, None, context));
|
||||||
|
}
|
||||||
|
|
||||||
self.view.as_mut().unwrap().draw(
|
self.view.as_mut().unwrap().draw(
|
||||||
grid,
|
grid,
|
||||||
(set_y(upper_left, mid + 1), bottom_right),
|
(set_y(upper_left, mid + 1), bottom_right),
|
||||||
|
|
Loading…
Reference in New Issue