Skip to content

Commit

Permalink
Restart fresh terminal instance upon quiting
Browse files Browse the repository at this point in the history
  • Loading branch information
nnh12 committed Nov 26, 2024
1 parent 1230e77 commit b69d78e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
12 changes: 6 additions & 6 deletions applications/less/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ use shell::Shell;


// The metadata for each line in the file.
// struct LineSlice {
// // The starting index in the String for a line. (inclusive)
// start: usize,
// // The ending index in the String for a line. (exclusive)
// end: usize
// }
struct LineSlice {
// The starting index in the String for a line. (inclusive)
start: usize,
// The ending index in the String for a line. (exclusive)
end: usize
}

//fn get_terminal_dimensions() -> Option<(usize, usize)> {
// match terminal_size() {
Expand Down
12 changes: 3 additions & 9 deletions applications/shell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ impl Shell {
Ok(shell)
}



/// Insert a character to the command line buffer in the shell.
/// The position to insert is determined by the position of the cursor in the terminal.
/// `sync_terminal` indicates whether the terminal screen will be synchronically updated.
Expand Down Expand Up @@ -527,21 +525,17 @@ impl Shell {
// Perform command line auto completion.
if keyevent.keycode == Keycode::Tab {
if self.fg_job_num.is_none() {
//let prompt = format!("Tab");
//self.terminal.lock().print_to_terminal(prompt);
//self.terminal.print_to_terminal(prompt);
self.complete_cmdline()?;
}
return Ok(());
}


if keyevent.keycode == Keycode::Q {
self.less = false;
self.less = false;
self.input_buffer = String::new();
self.terminal.lock().clear();
self.redisplay_prompt();
//if self.fg_job_num.is_none() {
// self.terminal.lock().print_to_terminal("Quit".to_string());
//}
return Ok(());
}

Expand Down

0 comments on commit b69d78e

Please sign in to comment.