diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 44985fb..885e03d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -73,6 +73,15 @@ fn run_command(raw: &ScopedRawMode, line: Vec<u8>) { return; } + b"clear" => clear_screen(), + #[cfg(debug_assertions)] + b"re" => { + // restart shell + raw.disable(); + let _ = Command::new("cargo").arg("run").status(); + raw.disable(); + std::process::exit(0); + } b"from" => todo!("read from file"), b"to" | b"into" => todo!("write into file"), b"append" => todo!("append to file"), @@ -156,6 +165,15 @@ fn env_path() { } } +fn completely_clear_screen() { + print!("\x1B[2J\x1B[1;1H"); +} + +fn clear_screen() { + completely_clear_screen(); + print!("{PROMPT}") +} + fn event_loop() { env_path(); @@ -187,16 +205,10 @@ fn event_loop() { } // Ctrl+L - 12 => todo!(), + 12 => clear_screen(), // Ctrl+R - 18 => { - // restart shell - raw.disable(); - let _ = Command::new("cargo").arg("run").status(); - raw.disable(); - std::process::exit(0); - }, + 18 => {} // Enter b'\r' => { |
