Added help footers

This commit is contained in:
veeso
2021-12-12 13:19:12 +01:00
committed by Christian Visintin
parent 2a3d4f2670
commit a93dbde0c8
11 changed files with 130 additions and 53 deletions

View File

@@ -76,13 +76,16 @@ impl Default for Footer {
fn default() -> Self {
Self {
component: Span::default().spans(&[
TextSpan::new("Press ").bold(),
TextSpan::new("<CTRL+H>").bold().fg(Color::Cyan),
TextSpan::new(" to show keybindings; ").bold(),
TextSpan::new("<CTRL+S>").bold().fg(Color::Cyan),
TextSpan::new(" to save parameters; ").bold(),
TextSpan::new("<F1|CTRL+H>").bold().fg(Color::Cyan),
TextSpan::new(" Help "),
TextSpan::new("<F4|CTRL+S>").bold().fg(Color::Cyan),
TextSpan::new(" Save parameters "),
TextSpan::new("<F10|ESC>").bold().fg(Color::Cyan),
TextSpan::new(" Exit "),
TextSpan::new("<TAB>").bold().fg(Color::Cyan),
TextSpan::new(" to change panel").bold(),
TextSpan::new(" Change panel "),
TextSpan::new("<UP/DOWN>").bold().fg(Color::Cyan),
TextSpan::new(" Change field "),
]),
}
}

View File

@@ -54,9 +54,10 @@ pub struct GlobalListener {
impl Component<Msg, NoUserEvent> for GlobalListener {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
match ev {
Event::Keyboard(KeyEvent { code: Key::Esc, .. }) => {
Some(Msg::Common(CommonMsg::ShowQuitPopup))
}
Event::Keyboard(KeyEvent {
code: Key::Esc | Key::Function(10),
..
}) => Some(Msg::Common(CommonMsg::ShowQuitPopup)),
Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => {
Some(Msg::Common(CommonMsg::ChangeLayout))
}
@@ -64,6 +65,10 @@ impl Component<Msg, NoUserEvent> for GlobalListener {
code: Key::Char('h'),
modifiers: KeyModifiers::CONTROL,
}) => Some(Msg::Common(CommonMsg::ShowKeybindings)),
Event::Keyboard(KeyEvent {
code: Key::Function(1),
modifiers: KeyModifiers::NONE,
}) => Some(Msg::Common(CommonMsg::ShowKeybindings)),
Event::Keyboard(KeyEvent {
code: Key::Char('r'),
modifiers: KeyModifiers::CONTROL,
@@ -72,6 +77,10 @@ impl Component<Msg, NoUserEvent> for GlobalListener {
code: Key::Char('s'),
modifiers: KeyModifiers::CONTROL,
}) => Some(Msg::Common(CommonMsg::ShowSavePopup)),
Event::Keyboard(KeyEvent {
code: Key::Function(4),
modifiers: KeyModifiers::NONE,
}) => Some(Msg::Common(CommonMsg::ShowSavePopup)),
_ => None,
}
}

View File

@@ -206,6 +206,13 @@ impl SetupActivity {
}),
Self::no_popup_mounted_clause(),
),
Sub::new(
SubEventClause::Keyboard(KeyEvent {
code: Key::Function(10),
modifiers: KeyModifiers::NONE,
}),
Self::no_popup_mounted_clause(),
),
Sub::new(
SubEventClause::Keyboard(KeyEvent {
code: Key::Tab,
@@ -220,6 +227,13 @@ impl SetupActivity {
}),
Self::no_popup_mounted_clause(),
),
Sub::new(
SubEventClause::Keyboard(KeyEvent {
code: Key::Function(1),
modifiers: KeyModifiers::NONE,
}),
Self::no_popup_mounted_clause(),
),
Sub::new(
SubEventClause::Keyboard(KeyEvent {
code: Key::Char('r'),
@@ -234,6 +248,13 @@ impl SetupActivity {
}),
Self::no_popup_mounted_clause(),
),
Sub::new(
SubEventClause::Keyboard(KeyEvent {
code: Key::Function(4),
modifiers: KeyModifiers::NONE,
}),
Self::no_popup_mounted_clause(),
),
]
)
.is_ok());

View File

@@ -59,9 +59,9 @@ impl SetupActivity {
.margin(1)
.constraints(
[
Constraint::Length(3), // Current tab
Constraint::Length(18), // Main body
Constraint::Length(3), // Help footer
Constraint::Length(3), // Current tab
Constraint::Min(18), // Main body
Constraint::Length(1), // Help footer
]
.as_ref(),
)
@@ -85,6 +85,7 @@ impl SetupActivity {
Constraint::Length(3), // Updates tab
Constraint::Length(3), // Prompt file replace
Constraint::Length(3), // Group dirs
Constraint::Length(1), // Prevent overflow
]
.as_ref(),
)
@@ -120,7 +121,7 @@ impl SetupActivity {
Constraint::Length(3), // Notifications enabled
Constraint::Length(3), // Notifications threshold
Constraint::Length(3), // Ssh config
Constraint::Length(1), // Filler
Constraint::Length(1), // Prevent overflow
]
.as_ref(),
)

View File

@@ -56,9 +56,9 @@ impl SetupActivity {
.margin(1)
.constraints(
[
Constraint::Length(3), // Current tab
Constraint::Percentage(90), // Main body
Constraint::Length(3), // Help footer
Constraint::Length(3), // Current tab
Constraint::Min(5), // Main body
Constraint::Length(1), // Help footer
]
.as_ref(),
)

View File

@@ -56,9 +56,9 @@ impl SetupActivity {
.margin(1)
.constraints(
[
Constraint::Length(3), // Current tab
Constraint::Length(22), // Main body
Constraint::Length(3), // Help footer
Constraint::Length(3), // Current tab
Constraint::Min(22), // Main body
Constraint::Length(1), // Help footer
]
.as_ref(),
)
@@ -91,6 +91,7 @@ impl SetupActivity {
Constraint::Length(3), // Password
Constraint::Length(3), // Bookmarks
Constraint::Length(3), // Recents
Constraint::Length(1), // Prevent overflow
]
.as_ref(),
)
@@ -126,6 +127,7 @@ impl SetupActivity {
Constraint::Length(3), // Quit
Constraint::Length(3), // Save
Constraint::Length(3), // Warn
Constraint::Length(1), // Prevent overflow
]
.as_ref(),
)
@@ -158,7 +160,7 @@ impl SetupActivity {
Constraint::Length(3), // remote explorer bg
Constraint::Length(3), // remote explorer fg
Constraint::Length(3), // remote explorer hg
Constraint::Length(3), // empty
Constraint::Length(1), // Prevent overflow
]
.as_ref(),
)
@@ -210,6 +212,7 @@ impl SetupActivity {
Constraint::Length(3), // status sorting
Constraint::Length(3), // status hidden
Constraint::Length(3), // sync browsing
Constraint::Length(1), // Prevent overflow
]
.as_ref(),
)