Show correct thread on unthreaded view

Closes #31
embed
Manos Pitsidianakis 2018-08-15 13:42:45 +03:00
parent 415ce2a27e
commit 832d1243de
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 6 additions and 3 deletions

View File

@ -52,6 +52,7 @@ impl ViewMode {
/// menus /// menus
pub struct MailView { pub struct MailView {
coordinates: (usize, usize, usize), coordinates: (usize, usize, usize),
local_collection: Vec<usize>,
pager: Option<Pager>, pager: Option<Pager>,
subview: Option<Box<Component>>, subview: Option<Box<Component>>,
dirty: bool, dirty: bool,
@ -70,11 +71,13 @@ impl fmt::Display for MailView {
impl MailView { impl MailView {
pub fn new( pub fn new(
coordinates: (usize, usize, usize), coordinates: (usize, usize, usize),
local_collection: Vec<usize>,
pager: Option<Pager>, pager: Option<Pager>,
subview: Option<Box<Component>>, subview: Option<Box<Component>>,
) -> Self { ) -> Self {
MailView { MailView {
coordinates, coordinates,
local_collection,
pager, pager,
subview, subview,
dirty: true, dirty: true,
@ -218,7 +221,7 @@ impl Component for MailView {
let envelope_idx: usize = if threaded { let envelope_idx: usize = if threaded {
mailbox.threaded_mail(self.coordinates.2) mailbox.threaded_mail(self.coordinates.2)
} else { } else {
self.coordinates.2 self.local_collection[self.coordinates.2]
}; };
let envelope: &Envelope = &mailbox.collection[envelope_idx]; let envelope: &Envelope = &mailbox.collection[envelope_idx];
@ -381,7 +384,7 @@ impl Component for MailView {
let envelope_idx: usize = if threaded { let envelope_idx: usize = if threaded {
mailbox.threaded_mail(self.coordinates.2) mailbox.threaded_mail(self.coordinates.2)
} else { } else {
self.coordinates.2 self.local_collection[self.coordinates.2]
}; };
let envelope: &Envelope = &mailbox.collection[envelope_idx]; let envelope: &Envelope = &mailbox.collection[envelope_idx];
@ -453,7 +456,7 @@ impl Component for MailView {
let envelope_idx: usize = if threaded { let envelope_idx: usize = if threaded {
mailbox.threaded_mail(self.coordinates.2) mailbox.threaded_mail(self.coordinates.2)
} else { } else {
self.coordinates.2 self.local_collection[self.coordinates.2]
}; };
let envelope: &Envelope = &mailbox.collection[envelope_idx]; let envelope: &Envelope = &mailbox.collection[envelope_idx];