cli: Don't add newlines for empty descriptions in editor
This commit is contained in:
parent
ae01a42434
commit
0441b048f9
|
|
@ -83,18 +83,19 @@ impl Message {
|
||||||
placeholder.push_str(title.as_ref());
|
placeholder.push_str(title.as_ref());
|
||||||
placeholder.push('\n');
|
placeholder.push('\n');
|
||||||
}
|
}
|
||||||
if let Some(description) = description {
|
if let Some(description) = description
|
||||||
|
.as_deref()
|
||||||
|
.map(str::trim)
|
||||||
|
.filter(|description| !description.is_empty())
|
||||||
|
{
|
||||||
placeholder.push('\n');
|
placeholder.push('\n');
|
||||||
placeholder.push_str(description.trim());
|
placeholder.push_str(description);
|
||||||
placeholder.push('\n');
|
placeholder.push('\n');
|
||||||
}
|
}
|
||||||
placeholder.push_str(help);
|
placeholder.push_str(help);
|
||||||
|
|
||||||
let output = Self::Edit.get(&placeholder)?;
|
let output = Self::Edit.get(&placeholder)?;
|
||||||
let (title, description) = match output.split_once("\n\n") {
|
let (title, description) = output.split_once("\n\n").unwrap_or((output.as_str(), ""));
|
||||||
Some((x, y)) => (x, y),
|
|
||||||
None => (output.as_str(), ""),
|
|
||||||
};
|
|
||||||
|
|
||||||
let Ok(title) = Title::new(title) else {
|
let Ok(title) = Title::new(title) else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue