mirror of https://github.com/helix-editor/helix
WIP: show all buffers that couldn't be closed
parent
6118486eb2
commit
e023a78919
|
@ -2090,6 +2090,7 @@ pub mod cmd {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut nonexistent_buffers = vec![];
|
||||||
for arg in args {
|
for arg in args {
|
||||||
let doc_id = editor.documents().find_map(|doc| {
|
let doc_id = editor.documents().find_map(|doc| {
|
||||||
let arg_path = Some(Path::new(arg.as_ref()));
|
let arg_path = Some(Path::new(arg.as_ref()));
|
||||||
|
@ -2104,12 +2105,19 @@ pub mod cmd {
|
||||||
|
|
||||||
match doc_id {
|
match doc_id {
|
||||||
Some(doc_id) => editor.close_document(doc_id, force)?,
|
Some(doc_id) => editor.close_document(doc_id, force)?,
|
||||||
None => {
|
None => nonexistent_buffers.push(arg),
|
||||||
editor.set_error(format!("couldn't close buffer '{}': does not exist", arg));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nonexistent_buffers: Vec<_> = nonexistent_buffers
|
||||||
|
.into_iter()
|
||||||
|
.map(|str| format!("'{}'", str))
|
||||||
|
.collect();
|
||||||
|
editor.set_error(format!(
|
||||||
|
"couldn't close buffer(s) {}: does not exist",
|
||||||
|
nonexistent_buffers.join(", ")
|
||||||
|
));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue