diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2023-12-29 16:28:46 -0800 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2023-12-29 16:28:46 -0800 |
| commit | aee3a1f70072b5a35f4bf2a938b3722295d7efa9 (patch) | |
| tree | 2af9b972768396d9eb717763bff0b57d3ea0b42b /src/main.rs | |
| parent | da54c7c2c103c9b1c98f0c5179945b0122a1eef7 (diff) | |
| download | editor-aee3a1f70072b5a35f4bf2a938b3722295d7efa9.tar.zst | |
Allow saving the file with CTRL-S.
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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; |
