on master help sign in
WIP: show all buffers that couldn't be closed
e023a78Cole Helbling
helix-term/src/commands.rs+11−3
@@ -2090,6 +2090,7 @@ pub mod cmd {
2090 return Ok(());
2090 return Ok(());
2091 }
2091 }
2092
2092
2093+ let mut nonexistent_buffers = vec![];
2093 for arg in args {
2094 for arg in args {
2094 let doc_id = editor.documents().find_map(|doc| {
2095 let doc_id = editor.documents().find_map(|doc| {
2095 let arg_path = Some(Path::new(arg.as_ref()));
2096 let arg_path = Some(Path::new(arg.as_ref()));
@@ -2104,12 +2105,19 @@ pub mod cmd {
2104
2105
2105 match doc_id {
2106 match doc_id {
2106 Some(doc_id) => editor.close_document(doc_id, force)?,
2107 Some(doc_id) => editor.close_document(doc_id, force)?,
2107− None => {
2108+ None => nonexistent_buffers.push(arg),
2108− editor.set_error(format!("couldn't close buffer '{}': does not exist", arg));
2109− }
2110 }
2109 }
2111 }
2110 }
2112
2111
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+
2113 Ok(())
2121 Ok(())
2114 }
2122 }
2115
2123