diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2018-08-11 22:47:38 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:28 +0300 |
commit | addd27f2093d5f0998680a9073719fbe2b52bedd (patch) | |
tree | 6d7d4adb4d5f0cbba679d2dfd02a08dfb67c8793 /ui | |
parent | d8137738b550c78d87592c784c5bcedb54de61aa (diff) |
Put root folders on top in account menu
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/components/mail/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ui/src/components/mail/mod.rs b/ui/src/components/mail/mod.rs index 96cfc8b8..b9714332 100644 --- a/ui/src/components/mail/mod.rs +++ b/ui/src/components/mail/mod.rs @@ -34,7 +34,9 @@ pub use self::compose::*; #[derive(Debug)] struct AccountMenuEntry { name: String, + // Index in the config account vector. index: usize, + // Each entry and its index in the account entries: Vec<(usize, Folder)>, } @@ -78,6 +80,9 @@ impl AccountMenu { cursor: None, } } + /* + * Print a single account in the menu area. + */ fn print_account( &self, grid: &mut CellBuffer, @@ -180,7 +185,7 @@ impl AccountMenu { lines[idx].to_string() }; let (color_fg, color_bg) = if highlight { - if idx > 1 && self.cursor.unwrap().1 == idx - 2 { + if self.cursor.unwrap().1 + 1 == idx { (Color::Byte(233), Color::Byte(15)) } else { (Color::Byte(15), Color::Byte(233)) @@ -198,7 +203,7 @@ impl AccountMenu { false, ); - if highlight && idx > 1 && self.cursor.unwrap().1 == idx - 2 { + if highlight && idx > 1 && self.cursor.unwrap().1 == idx - 1 { change_colors(grid, ((x, y), (get_x(bottom_right), y)), color_fg, color_bg); } else { change_colors(grid, ((x, y), set_y(bottom_right, y)), color_fg, color_bg); |