diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-04-07 11:15:53 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:43 +0300 |
commit | ada0950854b36a9f5f636a48180a6049b794c20a (patch) | |
tree | 2e07daf740e7abf0cb765e619d148e99bc1209d8 /ui/src/components | |
parent | e3d0ad9170a2619a55e3f210cf4d5796ba71cd56 (diff) |
ui: retain hidden properties in ThreadView
Diffstat (limited to 'ui/src/components')
-rw-r--r-- | ui/src/components/mail/view/thread.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ui/src/components/mail/view/thread.rs b/ui/src/components/mail/view/thread.rs index d04596eb..9a1549cc 100644 --- a/ui/src/components/mail/view/thread.rs +++ b/ui/src/components/mail/view/thread.rs @@ -143,6 +143,8 @@ impl ThreadView { return; } + let old_entries = self.entries.clone(); + let old_focused_entry = if self.entries.len() > self.cursor_pos { Some(self.entries.remove(self.cursor_pos)) } else { @@ -158,6 +160,25 @@ impl ThreadView { let expanded_pos = self.expanded_pos; self.initiate(Some(expanded_pos), context); + let mut old_cursor = 0; + let mut new_cursor = 0; + loop { + if old_cursor >= old_entries.len() || new_cursor >= self.entries.len() { + break; + } + if old_entries[old_cursor].msg_hash == self.entries[new_cursor].msg_hash + || old_entries[old_cursor].index == self.entries[new_cursor].index + || old_entries[old_cursor].heading == self.entries[new_cursor].heading + { + self.entries[new_cursor].hidden = old_entries[old_cursor].hidden; + old_cursor += 1; + new_cursor += 1; + } else { + new_cursor += 1; + } + self.recalc_visible_entries(); + } + if let Some(old_focused_entry) = old_focused_entry { if let Some(new_entry_idx) = self.entries.iter().position(|e| { e.msg_hash == old_focused_entry.msg_hash |