aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2023-12-27 10:34:05 -0800
committerRose Hogenson <rosehogenson@posteo.net>2023-12-27 10:34:05 -0800
commit9834d5905d6cb0f1324841e96af069cedeb97f02 (patch)
treef59f75c5fe896aa1a57516377d57c2b532294941
parentPrint each line separately. (diff)
downloadeditor-9834d5905d6cb0f1324841e96af069cedeb97f02.tar.zst
Handle error from putting terminal in raw mode.
-rw-r--r--src/main.rs7
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,