working at least a bit
This commit is contained in:
@@ -48,7 +48,7 @@ pub async fn run_client() -> Result<(), Box<dyn std::error::Error>> {
|
||||
];
|
||||
let mut command_mode = false;
|
||||
let mut command_input = String::new();
|
||||
let theme = Theme::default();
|
||||
let theme = Theme::dark();
|
||||
|
||||
loop {
|
||||
terminal.draw(|f| {
|
||||
@@ -112,7 +112,34 @@ pub async fn run_client() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if command_mode {
|
||||
match key.code {
|
||||
KeyCode::Enter => {
|
||||
match command_input.as_str() {
|
||||
"w" => break, // Save and exit
|
||||
"q" => { // Quit without saving
|
||||
disable_raw_mode()?;
|
||||
execute!(terminal.backend_mut(), LeaveAlternateScreen)?;
|
||||
return Ok(());
|
||||
}
|
||||
_ => {
|
||||
command_mode = false;
|
||||
command_input.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
KeyCode::Char(c) => command_input.push(c),
|
||||
KeyCode::Backspace => {
|
||||
command_input.pop();
|
||||
}
|
||||
KeyCode::Esc => {
|
||||
command_mode = false;
|
||||
command_input.clear();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
match key.code {
|
||||
KeyCode::Char(':') => {
|
||||
command_mode = true;
|
||||
|
||||
Reference in New Issue
Block a user