working at least a bit

This commit is contained in:
filipriec
2025-02-16 21:45:25 +01:00
parent c4356dcff6
commit 50d955b966
3 changed files with 67 additions and 5 deletions

View File

@@ -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;