Skip to content

Commit 9de3194

Browse files
committed
Add short note on how to quit
1 parent 7760257 commit 9de3194

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cmd/display.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use ratatui::{
2020
};
2121
use std::io::stdout;
2222

23+
const QUIT_KEY: char = 'q';
24+
2325
#[derive(Parser)]
2426
#[command(bin_name = "display")]
2527
struct Args {
@@ -45,7 +47,7 @@ pub async fn invoke(args: &[String], ctx: &mut Context) -> Result<String> {
4547
select! {
4648
msg = reader.next() => match msg {
4749
Some(Ok(Event::Key(e))) => match e.code {
48-
KeyCode::Char('q') => break,
50+
KeyCode::Char(QUIT_KEY) => break,
4951
_ => if let Some(code) = key_code_to_js(e.code) {
5052
ctx.lh.put(&path.as_lh_vec(), Model::InputEvent(InputEvent {
5153
source: 0,
@@ -66,7 +68,7 @@ pub async fn invoke(args: &[String], ctx: &mut Context) -> Result<String> {
6668
lh_frame,
6769
frame.size().width.into(),
6870
frame.size().height.into(),
69-
path.to_string()
71+
format!("{} ({}: quit)", path, QUIT_KEY),
7072
);
7173
frame.render_widget(canvas, frame.size());
7274
})?;

0 commit comments

Comments
 (0)