mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 13:22:28 +00:00
commit
18a6d4fac8
|
@ -16,7 +16,7 @@ pub struct ShortcutList {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Shortcut {
|
pub struct Shortcut {
|
||||||
pub key_sequenses: Vec<Span<'static>>,
|
pub key_sequences: Vec<Span<'static>>,
|
||||||
pub desc: &'static str,
|
pub desc: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ impl ShortcutList {
|
||||||
impl Shortcut {
|
impl Shortcut {
|
||||||
pub fn new(key_sequences: Vec<&'static str>, desc: &'static str) -> Self {
|
pub fn new(key_sequences: Vec<&'static str>, desc: &'static str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
key_sequenses: key_sequences
|
key_sequences: key_sequences
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| Span::styled(*s, Style::default().bold()))
|
.map(|s| Span::styled(*s, Style::default().bold()))
|
||||||
.collect(),
|
.collect(),
|
||||||
|
@ -85,7 +85,7 @@ impl Shortcut {
|
||||||
|
|
||||||
fn to_spans(&self) -> Vec<Span> {
|
fn to_spans(&self) -> Vec<Span> {
|
||||||
let mut ret: Vec<_> = self
|
let mut ret: Vec<_> = self
|
||||||
.key_sequenses
|
.key_sequences
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|seq| {
|
.flat_map(|seq| {
|
||||||
[
|
[
|
||||||
|
@ -124,10 +124,10 @@ pub fn draw_shortcuts(state: &AppState, frame: &mut Frame, area: Rect) {
|
||||||
if state.selected_item_is_up_dir() {
|
if state.selected_item_is_up_dir() {
|
||||||
hints.push(Shortcut::new(
|
hints.push(Shortcut::new(
|
||||||
vec!["l", "Right", "Enter", "h", "Left"],
|
vec!["l", "Right", "Enter", "h", "Left"],
|
||||||
"Go to parrent directory",
|
"Go to parent directory",
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
hints.push(Shortcut::new(vec!["h", "Left"], "Go to parrent directory"));
|
hints.push(Shortcut::new(vec!["h", "Left"], "Go to parent directory"));
|
||||||
hints.push(get_list_item_shortcut(state));
|
hints.push(get_list_item_shortcut(state));
|
||||||
if state.selected_item_is_cmd() {
|
if state.selected_item_is_cmd() {
|
||||||
hints.push(Shortcut::new(vec!["p"], "Enable preview"));
|
hints.push(Shortcut::new(vec!["p"], "Enable preview"));
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub struct AppState {
|
||||||
tabs: Vec<Tab>,
|
tabs: Vec<Tab>,
|
||||||
/// Current tab
|
/// Current tab
|
||||||
current_tab: ListState,
|
current_tab: ListState,
|
||||||
/// This stack keeps track of our "current dirrectory". You can think of it as `pwd`. but not
|
/// This stack keeps track of our "current directory". You can think of it as `pwd`. but not
|
||||||
/// just the current directory, all paths that took us here, so we can "cd .."
|
/// just the current directory, all paths that took us here, so we can "cd .."
|
||||||
visit_stack: Vec<NodeId>,
|
visit_stack: Vec<NodeId>,
|
||||||
/// This is the state asociated with the list widget, used to display the selection in the
|
/// This is the state asociated with the list widget, used to display the selection in the
|
||||||
|
@ -262,7 +262,7 @@ impl AppState {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks ehther the current tree node is the root node (can we go up the tree or no)
|
/// Checks either the current tree node is the root node (can we go up the tree or no)
|
||||||
/// Returns `true` if we can't go up the tree (we are at the tree root)
|
/// Returns `true` if we can't go up the tree (we are at the tree root)
|
||||||
/// else returns `false`
|
/// else returns `false`
|
||||||
pub fn at_root(&self) -> bool {
|
pub fn at_root(&self) -> bool {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user