@@ -297,9 +297,11 @@ pub fn split_selection(cx: &mut Context) {
300+ cx.callback = Some(Box::new(
300− cx.callback = Some(Box::new(move |compositor: &mut Compositor| {
301+ move |compositor: &mut Compositor, editor: &mut Editor| {
301− compositor.push(Box::new(prompt));
302+ compositor.push(Box::new(prompt));
305pub fn split_selection_on_newline(cx: &mut Context) {
307pub fn split_selection_on_newline(cx: &mut Context) {
@@ -399,12 +401,13 @@ pub fn append_mode(cx: &mut Context) {
400// TODO: I, A, o and O can share a lot of the primitives.
402// TODO: I, A, o and O can share a lot of the primitives.
401pub fn command_mode(cx: &mut Context) {
403pub fn command_mode(cx: &mut Context) {
402− cx.callback = Some(Box::new(|compositor: &mut Compositor| {
404+ cx.callback = Some(Box::new(
405+ |compositor: &mut Compositor, editor: &mut Editor| {
403− let prompt = Prompt::new(
406+ let prompt = Prompt::new(
404− ":".to_owned(),
407+ ":".to_owned(),
405− |_input: &str| {
408+ |_input: &str| {
406− // TODO: i need this duplicate list right now to avoid borrow checker issues
409+ // TODO: i need this duplicate list right now to avoid borrow checker issues
407− let command_list = vec![
410+ let command_list = vec![
408 String::from("q"),
411 String::from("q"),
409 String::from("aaa"),
412 String::from("aaa"),
410 String::from("bbb"),
413 String::from("bbb"),
@@ -437,37 +440,49 @@ pub fn command_mode(cx: &mut Context) {
437 String::from("ddd"),
440 String::from("ddd"),
438 String::from("eee"),
441 String::from("eee"),
440− command_list
443+ command_list
441− .into_iter()
444+ .into_iter()
442− .filter(|command| command.contains(_input))
445+ .filter(|command| command.contains(_input))
443− .collect()
446+ .collect()
444− }, // completion
447+ }, // completion
445− |editor: &mut Editor, input: &str, event: PromptEvent| {
448+ |editor: &mut Editor, input: &str, event: PromptEvent| {
446− if event != PromptEvent::Validate {
449+ if event != PromptEvent::Validate {
450− let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
453+ let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
452− match parts.as_slice() {
455+ match parts.as_slice() {
453− &["q"] => editor.should_close = true,
456+ &["q"] => editor.should_close = true,
454− &["o", path] => {
457+ &["o", path] => {
455− // TODO: make view()/view_mut() always contain a view.
458+ // TODO: make view()/view_mut() always contain a view.
456− let size = editor.view().unwrap().size;
459+ let size = editor.view().unwrap().size;
457− editor.open(path.into(), size);
460+ editor.open(path.into(), size);
463− compositor.push(Box::new(prompt));
466+ compositor.push(Box::new(prompt));
466pub fn file_picker(cx: &mut Context) {
470pub fn file_picker(cx: &mut Context) {
467− cx.callback = Some(Box::new(|compositor: &mut Compositor| {
471+ cx.callback = Some(Box::new(
472+ |compositor: &mut Compositor, editor: &mut Editor| {
468− let picker = ui::file_picker("./");
473+ let picker = ui::file_picker("./");
469− compositor.push(Box::new(picker));
474+ compositor.push(Box::new(picker));
479+pub fn buffer_picker(cx: &mut Context) {
480+ cx.callback = Some(Box::new(
481+ |compositor: &mut Compositor, editor: &mut Editor| {
482+ let picker = ui::buffer_picker(&editor.views, editor.focus);
483+ compositor.push(Box::new(picker));
473// calculate line numbers for each selection range
488// calculate line numbers for each selection range