Fix crash if no external editor is available
This commit is contained in:
parent
066ea0cb07
commit
42c23d6745
1 changed files with 4 additions and 1 deletions
|
|
@ -7,11 +7,14 @@ pub fn prompt(terminal: &mut Terminal, crossterm_lock: &Arc<FairMutex<()>>) -> O
|
|||
let content = {
|
||||
let _guard = crossterm_lock.lock();
|
||||
terminal.suspend().expect("could not suspend");
|
||||
let content = edit::edit("").expect("could not edit");
|
||||
let content = edit::edit("");
|
||||
terminal.unsuspend().expect("could not unsuspend");
|
||||
content
|
||||
};
|
||||
|
||||
// TODO Don't swipe this error under the rug
|
||||
let content = content.ok()?;
|
||||
|
||||
if content.trim().is_empty() {
|
||||
None
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue