diff options
author | Blaž Hrastnik | 2021-05-07 05:36:06 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-05-07 05:36:37 +0000 |
commit | f2c79e245bdcc70be3c51fdca35917a929615152 (patch) | |
tree | fc14a7da3ffab6e1cbd9b35029289afe623552bd /helix-term/src | |
parent | 418ee17b86c24f03699659f4aa91b331a68e5666 (diff) |
Allow switching views back to scratch buffers.
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/commands.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index eab9397c..5c1021e1 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -930,17 +930,14 @@ pub fn buffer_picker(cx: &mut Context) { path.into() } } - None => "[NEW]".into(), + None => "[scratch buffer]".into(), } }, - |editor: &mut Editor, (_, path): &(DocumentId, Option<PathBuf>), _action| match path { - Some(path) => { - use helix_view::editor::Action; - editor - .open(path.into(), Action::Replace) - .expect("editor.open failed"); - } - None => (), + |editor: &mut Editor, (id, _path): &(DocumentId, Option<PathBuf>), _action| { + use helix_view::editor::Action; + editor + .switch(*id, Action::Replace) + .expect("editor.open failed"); }, ); cx.push_layer(Box::new(picker)); |