ui: return valid values in ListingTrait::coordinates

By convention the valid values at any time of a cursor_pos in mail
listings is in self.new_cursor_pos, which the listing compares with
self.cursor_pos to detect position changes. Returning
self.cursor_pos values with coordinates() is invalid.
This commit is contained in:
Manos Pitsidianakis 2019-09-20 09:12:53 +03:00
parent fe28e849b3
commit 828718141a
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710
4 changed files with 6 additions and 12 deletions

View File

@ -101,7 +101,7 @@ pub struct CompactListing {
impl ListingTrait for CompactListing { impl ListingTrait for CompactListing {
fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>) { fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>) {
(self.cursor_pos.0, self.cursor_pos.1, None) (self.new_cursor_pos.0, self.new_cursor_pos.1, None)
} }
fn set_coordinates(&mut self, coordinates: (usize, usize, Option<EnvelopeHash>)) { fn set_coordinates(&mut self, coordinates: (usize, usize, Option<EnvelopeHash>)) {
self.new_cursor_pos = (coordinates.0, coordinates.1, 0); self.new_cursor_pos = (coordinates.0, coordinates.1, 0);
@ -498,9 +498,6 @@ impl CompactListing {
self.dirty = false; self.dirty = false;
return; return;
}; };
context
.replies
.push_back(UIEvent::RefreshMailbox((self.cursor_pos.0, folder_hash)));
// Get mailbox as a reference. // Get mailbox as a reference.
// //

View File

@ -104,7 +104,7 @@ pub struct ConversationsListing {
impl ListingTrait for ConversationsListing { impl ListingTrait for ConversationsListing {
fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>) { fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>) {
(self.cursor_pos.0, self.cursor_pos.1, None) (self.new_cursor_pos.0, self.new_cursor_pos.1, None)
} }
fn set_coordinates(&mut self, coordinates: (usize, usize, Option<EnvelopeHash>)) { fn set_coordinates(&mut self, coordinates: (usize, usize, Option<EnvelopeHash>)) {
@ -532,9 +532,6 @@ impl ConversationsListing {
self.dirty = false; self.dirty = false;
return; return;
}; };
context
.replies
.push_back(UIEvent::RefreshMailbox((self.cursor_pos.0, folder_hash)));
// Get mailbox as a reference. // Get mailbox as a reference.
// //

View File

@ -88,7 +88,7 @@ pub struct PlainListing {
impl ListingTrait for PlainListing { impl ListingTrait for PlainListing {
fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>) { fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>) {
(self.cursor_pos.0, self.cursor_pos.1, None) (self.new_cursor_pos.0, self.new_cursor_pos.1, None)
} }
fn set_coordinates(&mut self, coordinates: (usize, usize, Option<EnvelopeHash>)) { fn set_coordinates(&mut self, coordinates: (usize, usize, Option<EnvelopeHash>)) {
self.new_cursor_pos = (coordinates.0, coordinates.1, 0); self.new_cursor_pos = (coordinates.0, coordinates.1, 0);

View File

@ -51,9 +51,9 @@ pub struct ThreadListing {
impl ListingTrait for ThreadListing { impl ListingTrait for ThreadListing {
fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>) { fn coordinates(&self) -> (usize, usize, Option<EnvelopeHash>) {
( (
self.cursor_pos.0, self.new_cursor_pos.0,
self.cursor_pos.1, self.new_cursor_pos.1,
Some(self.locations[self.cursor_pos.2]), Some(self.locations[self.new_cursor_pos.2]),
) )
} }
fn set_coordinates(&mut self, coordinates: (usize, usize, Option<EnvelopeHash>)) { fn set_coordinates(&mut self, coordinates: (usize, usize, Option<EnvelopeHash>)) {