Skip to content

Commit

Permalink
Merge pull request #66 from chelmertz/ctrl-c-to-quit
Browse files Browse the repository at this point in the history
feat: Quit program with ctrl+c
  • Loading branch information
jacek-kurlit authored Sep 18, 2024
2 parents 6b3dc9d + afbef50 commit 4908201
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ cargo binstall pik

### Key maps

- Esc - Quit
- Esc | Ctrl + C - Quit
- Ctrl + X - Kill process
- Ctrl + R - Refresh processes list
- Ctrl + F - Details forward
Expand Down
3 changes: 3 additions & 0 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut app: App) -> io::Result<(
Esc => return Ok(()),
Up | BackTab => app.tui.select_previous_row(),
Tab | Down => app.tui.select_next_row(),
Char('c') if key.modifiers.contains(KeyModifiers::CONTROL) => {
return Ok(());
}
Char('x') if key.modifiers.contains(KeyModifiers::CONTROL) => {
app.kill_selected_process()
}
Expand Down
2 changes: 1 addition & 1 deletion src/tui/rendering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ fn process_details_lines(selected_process: Option<&Process>) -> Vec<Line> {
}

const HELP_TEXT: &str =
"ESC quit | <C+X> kill process | <C+R> refresh | <C+F> details forward | <C+B> details backward ";
"ESC/<C+C> quit | <C+X> kill process | <C+R> refresh | <C+F> details forward | <C+B> details backward ";

fn render_help(f: &mut Frame, error_message: Option<&str>, area: Rect) {
let rects = Layout::horizontal([Constraint::Percentage(25), Constraint::Percentage(75)])
Expand Down

0 comments on commit 4908201

Please sign in to comment.