aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorCole Helbling2021-11-20 21:42:40 +0000
committerBlaž Hrastnik2022-02-17 05:02:42 +0000
commite023a78919be31a9d9747d3735dfd29dd6c6605d (patch)
tree4dd3ee03a6aceeef730f94c2f974d08a76f1a18a /helix-term
parent6118486eb2dd7ed680ff38a7cc024dbfb26fbb7f (diff)
WIP: show all buffers that couldn't be closed
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index bf87f446..2c1535b6 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2090,6 +2090,7 @@ pub mod cmd {
return Ok(());
}
+ let mut nonexistent_buffers = vec![];
for arg in args {
let doc_id = editor.documents().find_map(|doc| {
let arg_path = Some(Path::new(arg.as_ref()));
@@ -2104,12 +2105,19 @@ pub mod cmd {
match doc_id {
Some(doc_id) => editor.close_document(doc_id, force)?,
- None => {
- editor.set_error(format!("couldn't close buffer '{}': does not exist", arg));
- }
+ None => nonexistent_buffers.push(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(())
}