diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-04-26 11:04:30 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:45 +0300 |
commit | 1e44089d84f32e59c2f8544b00cd60dbaee45b5b (patch) | |
tree | 4a921c96b326e5dfd94c57347bc0d82503e4e7dd /ui/src/components/mail/view | |
parent | 596194fa47420c912db9ea8b7b7d96ce4bf31280 (diff) |
ui: Refer to child/parents with FolderHash in BackendFolder
- use a stack to build folder order list in conf/accounts.rs
- update side menu print
Diffstat (limited to 'ui/src/components/mail/view')
-rw-r--r-- | ui/src/components/mail/view/thread.rs | 62 |
1 files changed, 3 insertions, 59 deletions
diff --git a/ui/src/components/mail/view/thread.rs b/ui/src/components/mail/view/thread.rs index 81e9ca66..2b591dfc 100644 --- a/ui/src/components/mail/view/thread.rs +++ b/ui/src/components/mail/view/thread.rs @@ -54,63 +54,6 @@ pub struct ThreadView { id: ComponentId, } -#[derive(Debug)] -struct StackVec { - len: usize, - array: [usize; 8], - heap_vec: Vec<usize>, -} - -impl StackVec { - fn new() -> Self { - StackVec { - len: 0, - array: [0, 0, 0, 0, 0, 0, 0, 0], - heap_vec: Vec::new(), - } - } - fn push(&mut self, ind: usize) { - if self.len == self.array.len() { - self.heap_vec.clear(); - self.heap_vec.reserve(16); - self.heap_vec.copy_from_slice(&self.array); - self.heap_vec.push(ind); - } else if self.len > self.array.len() { - self.heap_vec.push(ind); - } else { - self.array[self.len] = ind; - } - self.len += 1; - } - fn pop(&mut self) -> usize { - if self.len >= self.array.len() { - self.heap_vec.pop().unwrap() - } else { - let ret = self.array[self.len]; - self.len = self.len.saturating_sub(1); - ret - } - } - fn len(&self) -> usize { - self.len - } - fn is_empty(&self) -> bool { - self.len == 0 - } -} - -impl Index<usize> for StackVec { - type Output = usize; - - fn index(&self, idx: usize) -> &usize { - if self.len >= self.array.len() { - &self.heap_vec[idx] - } else { - &self.array[idx] - } - } -} - impl ThreadView { /* * coordinates: (account index, mailbox index, root set thread_node index) @@ -133,7 +76,8 @@ impl ThreadView { cursor_pos: 1, new_cursor_pos: 0, dirty: true, - id: ComponentId::new_v4(), ..Default::default() + id: ComponentId::new_v4(), + ..Default::default() }; view.initiate(expanded_idx, context); view.new_cursor_pos = view.new_expanded_pos; @@ -875,7 +819,7 @@ impl Component for ThreadView { .operation(envelope.hash(), mailbox.folder.hash()); if cfg!(debug_assertions) { eprint!("{}:{}_{}: ", file!(), line!(), column!()); -eprintln!( + eprintln!( "sending action edit for {}, {}", envelope.message_id(), op.description() |