blob: 010cf1865aabd73aaca39bf054b0a7ba92623ad2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
extern crate ncurses;
use std;
use joshuto::command::JoshutoCommand;
use joshuto::command::JoshutoRunnable;
use joshuto::context::JoshutoContext;
use joshuto::preview;
#[derive(Clone, Debug)]
pub struct ReloadDirList;
impl ReloadDirList {
pub fn new() -> Self {
ReloadDirList
}
pub const fn command() -> &'static str {
"reload_dir_list"
}
pub fn reload(context: &mut JoshutoContext) {
let curr_tab = &mut context.tabs[context.curr_tab_index];
curr_tab.reload_contents(&context.config_t.sort_type);
curr_tab.refresh(
&context.views,
&context.config_t,
&context.username,
&context.hostname,
);
}
}
impl JoshutoCommand for ReloadDirList {}
impl std::fmt::Display for ReloadDirList {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(Self::command())
}
}
impl JoshutoRunnable for ReloadDirList {
fn execute(&self, context: &mut JoshutoContext) {
Self::reload(context);
preview::preview_file(context);
ncurses::doupdate();
}
}
|