mirror of
https://github.com/apognu/tuigreet.git
synced 2024-10-05 20:07:32 +03:00
ESC now resets the form and session.
This commit is contained in:
parent
0c5b66df2d
commit
0b21921b4d
@ -1,4 +1,4 @@
|
||||
name: Development unpublished build
|
||||
name: Development build
|
||||
|
||||
on:
|
||||
push:
|
@ -6,6 +6,7 @@ use termion::event::Key;
|
||||
|
||||
use crate::{
|
||||
event::{Event, Events},
|
||||
ipc::cancel,
|
||||
ui::{PowerOption, POWER_OPTIONS},
|
||||
Greeter, Mode,
|
||||
};
|
||||
@ -13,6 +14,11 @@ use crate::{
|
||||
pub fn handle(greeter: &mut Greeter, events: &Events) -> Result<(), Box<dyn Error>> {
|
||||
if let Event::Input(input) = events.next()? {
|
||||
match input {
|
||||
Key::Esc => {
|
||||
cancel(greeter);
|
||||
greeter.reset();
|
||||
}
|
||||
|
||||
Key::Left => greeter.cursor_offset -= 1,
|
||||
Key::Right => greeter.cursor_offset += 1,
|
||||
|
||||
|
@ -24,6 +24,7 @@ use crate::{info::capslock_status, Greeter, Mode};
|
||||
|
||||
pub use self::power::{Option as PowerOption, OPTIONS as POWER_OPTIONS};
|
||||
|
||||
const RESET: &str = "Reset";
|
||||
const SESSIONS: &str = "Choose session";
|
||||
const CHANGE_COMMAND: &str = "Change command";
|
||||
const COMMAND: &str = "COMMAND";
|
||||
@ -80,6 +81,8 @@ pub fn draw(terminal: &mut Terminal<TermionBackend<RawTerminal<io::Stdout>>>, gr
|
||||
|
||||
let command = greeter.command.clone().unwrap_or_else(|| "-".to_string());
|
||||
let status_left_text = Spans::from(vec![
|
||||
status_label("ESC"),
|
||||
status_value(RESET),
|
||||
status_label("F2"),
|
||||
status_value(CHANGE_COMMAND),
|
||||
status_label("F3"),
|
||||
|
Loading…
Reference in New Issue
Block a user