Put root folders on top in account menu

embed
Manos Pitsidianakis 2018-08-11 22:47:38 +03:00
parent d8137738b5
commit addd27f209
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
2 changed files with 9 additions and 4 deletions

View File

@ -246,16 +246,16 @@ impl MaildirType {
children
};
let path = PathBuf::from(f.root_folder());
let path_children = recurse_folders(&mut folders, &path);
if path.is_dir() {
if let Ok(f) = MaildirFolder::new(
path.to_str().unwrap().to_string(),
path.file_name().unwrap().to_str().unwrap().to_string(),
path_children,
Vec::with_capacity(0),
) {
folders.push(f);
}
}
folders[0].children = recurse_folders(&mut folders, &path);
MaildirType {
folders,
path: f.root_folder().to_string(),

View File

@ -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);