on master help sign in
WIP: show all buffers that couldn't be closed
commite023a78919be31a9d9747d3735dfd29dd6c6605d authorCole Helbling <cole.e.helbling@outlook.com> dateSat 20 Nov 2021, 13:42 (5 years ago) parent6118486
1 file changed+11−3
helix-term/src/commands.rs+11−3
helix-term/src/commands.rs+11−3
@@ -2090,6 +2090,7 @@ pub mod cmd {
20902090 return Ok(());
20912091 }
20922092
2093+ let mut nonexistent_buffers = vec![];
20932094 for arg in args {
20942095 let doc_id = editor.documents().find_map(|doc| {
20952096 let arg_path = Some(Path::new(arg.as_ref()));
@@ -2104,12 +2105,19 @@ pub mod cmd {
21042105
21052106 match doc_id {
21062107 Some(doc_id) => editor.close_document(doc_id, force)?,
2107− None => {
2108− editor.set_error(format!("couldn't close buffer '{}': does not exist", arg));
2109− }
2108+ None => nonexistent_buffers.push(arg),
21102109 }
21112110 }
21122111
2112+ let nonexistent_buffers: Vec<_> = nonexistent_buffers
2113+ .into_iter()
2114+ .map(|str| format!("'{}'", str))
2115+ .collect();
2116+ editor.set_error(format!(
2117+ "couldn't close buffer(s) {}: does not exist",
2118+ nonexistent_buffers.join(", ")
2119+ ));
2120+
21132121 Ok(())
21142122 }
21152123