mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-21 21:09:42 +00:00
Fix description and preview hints (#495)
This commit is contained in:
parent
2fe6ab6b5d
commit
831f71bf43
|
@ -100,11 +100,18 @@ impl Shortcut {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_list_item_shortcut(state: &AppState) -> Shortcut {
|
fn get_list_item_shortcut(state: &AppState) -> Vec<Shortcut> {
|
||||||
if state.selected_item_is_dir() {
|
if state.selected_item_is_dir() {
|
||||||
Shortcut::new(vec!["l", "Right", "Enter"], "Go to selected dir")
|
vec![Shortcut::new(
|
||||||
|
vec!["l", "Right", "Enter"],
|
||||||
|
"Go to selected dir",
|
||||||
|
)]
|
||||||
} else {
|
} else {
|
||||||
Shortcut::new(vec!["l", "Right", "Enter"], "Run selected command")
|
vec![
|
||||||
|
Shortcut::new(vec!["l", "Right", "Enter"], "Run selected command"),
|
||||||
|
Shortcut::new(vec!["p"], "Enable preview"),
|
||||||
|
Shortcut::new(vec!["d"], "Command Description"),
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +128,7 @@ pub fn draw_shortcuts(state: &AppState, frame: &mut Frame, area: Rect) {
|
||||||
|
|
||||||
if state.at_root() {
|
if state.at_root() {
|
||||||
hints.push(Shortcut::new(vec!["h", "Left"], "Focus tab list"));
|
hints.push(Shortcut::new(vec!["h", "Left"], "Focus tab list"));
|
||||||
hints.push(get_list_item_shortcut(state));
|
hints.extend(get_list_item_shortcut(state));
|
||||||
} else {
|
} else {
|
||||||
if state.selected_item_is_up_dir() {
|
if state.selected_item_is_up_dir() {
|
||||||
hints.push(Shortcut::new(
|
hints.push(Shortcut::new(
|
||||||
|
@ -130,14 +137,9 @@ pub fn draw_shortcuts(state: &AppState, frame: &mut Frame, area: Rect) {
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
hints.push(Shortcut::new(vec!["h", "Left"], "Go to parent directory"));
|
hints.push(Shortcut::new(vec!["h", "Left"], "Go to parent directory"));
|
||||||
hints.push(get_list_item_shortcut(state));
|
hints.extend(get_list_item_shortcut(state));
|
||||||
if state.selected_item_is_cmd() {
|
|
||||||
hints.push(Shortcut::new(vec!["p"], "Enable preview"));
|
|
||||||
hints.push(Shortcut::new(vec!["d"], "Command Description"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
hints.push(Shortcut::new(vec!["k", "Up"], "Select item above"));
|
hints.push(Shortcut::new(vec!["k", "Up"], "Select item above"));
|
||||||
hints.push(Shortcut::new(vec!["j", "Down"], "Select item below"));
|
hints.push(Shortcut::new(vec!["j", "Down"], "Select item below"));
|
||||||
hints.push(Shortcut::new(vec!["t"], "Next theme"));
|
hints.push(Shortcut::new(vec!["t"], "Next theme"));
|
||||||
|
|
|
@ -316,8 +316,8 @@ impl AppState {
|
||||||
Focus::List if key.kind != KeyEventKind::Release => match key.code {
|
Focus::List if key.kind != KeyEventKind::Release => match key.code {
|
||||||
KeyCode::Char('j') | KeyCode::Down => self.selection.select_next(),
|
KeyCode::Char('j') | KeyCode::Down => self.selection.select_next(),
|
||||||
KeyCode::Char('k') | KeyCode::Up => self.selection.select_previous(),
|
KeyCode::Char('k') | KeyCode::Up => self.selection.select_previous(),
|
||||||
KeyCode::Char('p') => self.enable_preview(),
|
KeyCode::Char('p') | KeyCode::Char('P') => self.enable_preview(),
|
||||||
KeyCode::Char('d') => self.enable_description(),
|
KeyCode::Char('d') | KeyCode::Char('D') => self.enable_description(),
|
||||||
KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => self.handle_enter(),
|
KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => self.handle_enter(),
|
||||||
KeyCode::Char('h') | KeyCode::Left => {
|
KeyCode::Char('h') | KeyCode::Left => {
|
||||||
if self.at_root() {
|
if self.at_root() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user