fn update_tab(siv: &mut Cursive, tab: &mut Tab) {
        // let focused = if !forward { tab.p_focused } else {
        //     if let Some(c) = tab.c_focused {c}
        //     else {0}
        // };
        siv.call_on_id(
            "current",
            |event_view: &mut OnEventView<MultiSelectView<PathBuf>>| {
                let c_focused = tab.focused.get(&tab.c_view).unwrap_or(&0usize);
                debug!("Got current selection of: {:?}", c_focused);
                let view = event_view.get_inner_mut();
                view.clear();
                for entry in App::get_path_iter(&tab.c_view)
                    .filter_entry(|e| e.path().is_dir() && !filter::is_hidden(e))
                {
                    let entry = entry.unwrap();
                    match entry.file_name().to_str() {
                        Some(c) => {
                            view.add_item(format!(r"  {}", c), PathBuf::from(entry.path()))
                        }
                        None => {}
                    }
                }
                for entry in App::get_path_iter(&tab.c_view)
                    .filter_entry(|e| e.path().is_file() && !filter::is_hidden(e))
                {
                    let entry = entry.unwrap();
                    match entry.file_name().to_str() {
                        Some(c) => {
                            view.add_item(format!(r"  {}", c), PathBuf::from(entry.path()))
                        }
                        None => {}
                    };
                }
                // TODO keep last selection
                view.set_selection(*c_focused);
                //view.set_selection(focused);
            },
        );

        let mut i: usize = 0;
        siv.call_on_id("parent", |view: &mut MultiSelectView<PathBuf>| {
            view.clear();
            match tab.p_view.to_str() {
                Some("root") => {
                    view.add_item("/", PathBuf::from("/"));
                    view.set_selection(0);
                }
                Some(_) | None => {
                    for (index, entry) in App::get_path_iter(&tab.p_view)
                        .filter_entry(|e| e.path().is_dir() && !filter::is_hidden(e))
                        .enumerate()
                    {
                        let entry = entry.unwrap();
                        if entry.path() == &tab.c_view {
                            i = index;
                        }
                        match entry.file_name().to_str() {
                            Some(c) => {
                                view.add_item(format!("  {}", c), PathBuf::from(entry.path()))
                            }
                            None => {}
                        };
                    }
                    for entry in App::get_path_iter(&tab.p_view)
                        .filter_entry(|e| e.path().is_file() && !filter::is_hidden(e))
                    {
                        let entry = entry.unwrap();
                        match entry.file_name().to_str() {
                            Some(c) => {
                                view.add_item(format!("  {}", c), PathBuf::from(entry.path()))
                            }
                            None => {}
                        };
                    }
                    view.set_selection(i);
                }
            }
        });
        // tab.p_focused = i;
        tab.focused.insert(PathBuf::from(&tab.p_view), i);
        debug!("Updated focused for parent: {:?}", tab);
    }
/// Funtion which updates the content of `Tab` when you go forward or
/// backward in a hierarchy.
Funtion which updates the content of `Tab` when you go forward or
backward in a hierarchy.
Funtion which updates the content of ` Tab ` when you go forward or backward in a hierarchy .
fn update_tab(siv: &mut Cursive, tab: &mut Tab) {
        // let focused = if !forward { tab.p_focused } else {
        //     if let Some(c) = tab.c_focused {c}
        //     else {0}
        // };
        siv.call_on_id(
            "current",
            |event_view: &mut OnEventView<MultiSelectView<PathBuf>>| {
                let c_focused = tab.focused.get(&tab.c_view).unwrap_or(&0usize);
                debug!("Got current selection of: {:?}", c_focused);
                let view = event_view.get_inner_mut();
                view.clear();
                for entry in App::get_path_iter(&tab.c_view)
                    .filter_entry(|e| e.path().is_dir() && !filter::is_hidden(e))
                {
                    let entry = entry.unwrap();
                    match entry.file_name().to_str() {
                        Some(c) => {
                            view.add_item(format!(r"  {}", c), PathBuf::from(entry.path()))
                        }
                        None => {}
                    }
                }
                for entry in App::get_path_iter(&tab.c_view)
                    .filter_entry(|e| e.path().is_file() && !filter::is_hidden(e))
                {
                    let entry = entry.unwrap();
                    match entry.file_name().to_str() {
                        Some(c) => {
                            view.add_item(format!(r"  {}", c), PathBuf::from(entry.path()))
                        }
                        None => {}
                    };
                }
                // TODO keep last selection
                view.set_selection(*c_focused);
                //view.set_selection(focused);
            },
        );
        let mut i: usize = 0;
        siv.call_on_id("parent", |view: &mut MultiSelectView<PathBuf>| {
            view.clear();
            match tab.p_view.to_str() {
                Some("root") => {
                    view.add_item("/", PathBuf::from("/"));
                    view.set_selection(0);
                }
                Some(_) | None => {
                    for (index, entry) in App::get_path_iter(&tab.p_view)
                        .filter_entry(|e| e.path().is_dir() && !filter::is_hidden(e))
                        .enumerate()
                    {
                        let entry = entry.unwrap();
                        if entry.path() == &tab.c_view {
                            i = index;
                        }
                        match entry.file_name().to_str() {
                            Some(c) => {
                                view.add_item(format!("  {}", c), PathBuf::from(entry.path()))
                            }
                            None => {}
                        };
                    }
                    for entry in App::get_path_iter(&tab.p_view)
                        .filter_entry(|e| e.path().is_file() && !filter::is_hidden(e))
                    {
                        let entry = entry.unwrap();
                        match entry.file_name().to_str() {
                            Some(c) => {
                                view.add_item(format!("  {}", c), PathBuf::from(entry.path()))
                            }
                            None => {}
                        };
                    }
                    view.set_selection(i);
                }
            }
        });
        // tab.p_focused = i;
        tab.focused.insert(PathBuf::from(&tab.p_view), i);
        debug!("Updated focused for parent: {:?}", tab);
    }
fn update_tab ( siv : & mut Cursive , tab : & mut Tab ) { // let focused = if !forward { tab.p_focused } else { //     if let Some(c) = tab.c_focused {c} //     else {0} // }; siv . call_on_id ( " " , | event_view : & mut OnEventView < MultiSelectView < PathBuf > > | { let c_focused = tab . focused . get ( & tab . c_view ) . unwrap_or ( & 0usize ) ; debug ! ( " " c_focused ) ; let view = event_view . get_inner_mut ( ) ; view . clear ( ) ; for entry in App :: get_path_iter ( & tab . c_view ) . filter_entry ( | e | e . path ( ) . is_dir ( ) && ! filter :: is_hidden ( e ) ) { let entry = entry . unwrap ( ) ; match entry . file_name ( ) . to_str ( ) { Some ( c ) => { view . add_item ( format ! ( r"  {}",  , P thBuf:: fr om(e n try.p a th() ) ) } None => { } } } for entry in App :: get_path_iter ( & tab . c_view ) . filter_entry ( | e | e . path ( ) . is_file ( ) && ! filter :: is_hidden ( e ) ) { let entry = entry . unwrap ( ) ; match entry . file_name ( ) . to_str ( ) { Some ( c ) => { view . add_item ( format ! ( r"  {}",  , P thBuf:: fr om(e n try.p a th() ) ) } None => { } } ; } // TODO keep last selection view . set_selection ( * c_focused ) ; //view.set_selection(focused); } , ) ; let mut i : usize = 0 ; siv . call_on_id ( " " , | view : & mut MultiSelectView < PathBuf > | { view . clear ( ) ; match tab . p_view . to_str ( ) { Some ( " " ) => { view . add_item ( " " , PathBuf :: from ( " " ) ) ; view . set_selection ( 0 ) ; } Some ( _ ) | None => { for ( index , entry ) in App :: get_path_iter ( & tab . p_view ) . filter_entry ( | e | e . path ( ) . is_dir ( ) && ! filter :: is_hidden ( e ) ) . enumerate ( ) { let entry = entry . unwrap ( ) ; if entry . path ( ) == & tab . c_view { i = index ; } match entry . file_name ( ) . to_str ( ) { Some ( c ) => { view . add_item ( format ! ( " , P thBuf:: fr om(e n try.p a th() ) ) } None => { } } ; } for entry in App :: get_path_iter ( & tab . p_view ) . filter_entry ( | e | e . path ( ) . is_file ( ) && ! filter :: is_hidden ( e ) ) { let entry = entry . unwrap ( ) ; match entry . file_name ( ) . to_str ( ) { Some ( c ) => { view . add_item ( format ! ( " , P thBuf:: fr om(e n try.p a th() ) ) } None => { } } ; } view . set_selection ( i ) ; } } } ) ; // tab.p_focused = i; tab . focused . insert ( PathBuf :: from ( & tab . p_view ) , i ) ; debug ! ( " " tab ) ; }
Funtion which updates the content of `Tab` when you go forward or
backward in a hierarchy.
Funtion which updates the content of ` Tab ` when you go forward or backward in a hierarchy .
siv
&mut Cursive
tab
&mut Tab
siv
&mut Cursive
tab
&mut Tab