@@ -262,24 +262,23 @@ pub fn split_selection(cx: &mut Context) {
262 // # update state
262 // # update state
265− cx.callback = Some(Box::new(|compositor: &mut Compositor| {
266− let prompt = Prompt::new(
265+ let prompt = Prompt::new(
267− "split:".to_string(),
266+ "split:".to_string(),
268− |input: &str| Vec::new(), // this is fine because Vec::new() doesn't allocate
267+ |input: &str| Vec::new(), // this is fine because Vec::new() doesn't allocate
269− |editor: &mut Editor, input: &str| {
268+ |editor: &mut Editor, input: &str| {
270− match Regex::new(input) {
269+ match Regex::new(input) {
271− Ok(regex) => {
270+ Ok(regex) => {
272− let view = editor.view_mut().unwrap();
271+ let view = editor.view_mut().unwrap();
273− let text = &view.doc.text().slice(..);
272+ let text = &view.doc.text().slice(..);
275− selection::split_on_matches(text, view.doc.selection(), ®ex);
273+ let selection = selection::split_on_matches(text, view.doc.selection(), ®ex);
276− view.doc.set_selection(selection);
274+ view.doc.set_selection(selection);
278− Err(_) => (), // TODO: mark command line as error
276+ Err(_) => (), // TODO: mark command line as error
281+ cx.callback = Some(Box::new(move |compositor: &mut Compositor| {
283 compositor.push(Box::new(prompt));
282 compositor.push(Box::new(prompt));