diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2023-12-27 10:34:05 -0800 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2023-12-27 10:34:05 -0800 |
| commit | 9834d5905d6cb0f1324841e96af069cedeb97f02 (patch) | |
| tree | f59f75c5fe896aa1a57516377d57c2b532294941 /src | |
| parent | 38955a421bbf80ea0c2291c3a7b0a5f4034e8077 (diff) | |
| download | editor-9834d5905d6cb0f1324841e96af069cedeb97f02.tar.zst | |
Handle error from putting terminal in raw mode.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 79bff16..844b396 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,12 @@ use std::io::Write; use std::path::Path; fn edit(file: &OsStr) -> Result<(), String> { - let _raw_handle = term::raw(); + let _raw_handle = match term::raw() { + Some(h) => h, + None => { + return Err(String::from("cannot put terminal in raw mode")); + } + }; let r = match Rope::open(Path::new(file)) { Ok(r) => r, |
