Skip to content

Commit

Permalink
Trim :editor output and check if it's empty (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Collins committed May 25, 2024
1 parent 59e1862 commit a18d0f5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/windows/room/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,14 @@ impl ChatState {
let msg = if let SendAction::SubmitFromEditor = act {
let suffix =
store.application.settings.tunables.external_edit_file_suffix.as_str();
external_edit(msg.trim_end().to_string(), Builder::new().suffix(suffix))?
let edited_msg =
external_edit(msg.trim_end().to_string(), Builder::new().suffix(suffix))?
.trim_end()
.to_string();
if edited_msg.is_empty() {
return Ok(None);
}
edited_msg
} else if msg.is_blank() {
return Ok(None);
} else {
Expand Down

0 comments on commit a18d0f5

Please sign in to comment.