mirror of
https://git.meli.delivery/meli/meli
synced 2024-11-19 03:25:38 +00:00
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:
parent
fe28e849b3
commit
828718141a
@ -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.
|
||||||
//
|
//
|
||||||
|
@ -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.
|
||||||
//
|
//
|
||||||
|
@ -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);
|
||||||
|
@ -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>)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user