Remove trailing newline of externally edited text
This commit is contained in:
parent
c4d3f5ba4d
commit
f48a4a6416
1 changed files with 5 additions and 1 deletions
|
|
@ -323,7 +323,11 @@ impl EditorState {
|
|||
pub fn edit_externally(&self, terminal: &mut Terminal, crossterm_lock: &Arc<FairMutex<()>>) {
|
||||
let mut guard = self.0.lock();
|
||||
if let Some(text) = util::prompt(terminal, crossterm_lock, &guard.text) {
|
||||
guard.set_text(terminal.frame(), text);
|
||||
if let Some(text) = text.strip_suffix('\n') {
|
||||
guard.set_text(terminal.frame(), text.to_string());
|
||||
} else {
|
||||
guard.set_text(terminal.frame(), text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue