From aee3a1f70072b5a35f4bf2a938b3722295d7efa9 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Fri, 29 Dec 2023 16:28:46 -0800 Subject: Allow saving the file with CTRL-S. --- src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index dd20c3f..d376c2d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,6 +65,11 @@ fn edit(file: &OsStr) -> Result<(), String> { Key::CtrlQ => { break; } + Key::CtrlS => { + if let Err(err) = r.save(Path::new(file)) { + return Err(format!("write file {}: {}", file.to_string_lossy(), err)); + } + } Key::Up => { if cursor_row == 0 { continue; -- cgit v1.3.1