on master help sign in
fix warnings
commitae8ff9623efdf2a4267358d87d779b313c695689 authorJan Hrastnik <jan.hrastnik2@gmail.com> dateMon 19 Oct 2020, 16:16 (6 years ago) parentbc2c652
3 files changed+7−18
helix-view/src/commands.rs−15 helix-view/src/keymap.rs−1 helix-view/src/prompt.rs+7−2
helix-view/src/commands.rs−15
@@ -307,21 +307,6 @@ pub fn append_mode(view: &mut View, _count: usize) {
307307 })
308308}
309309
310−pub fn command_mode(_view: &mut View, _count: usize) {
311− use crate::Editor;
312−
313− let prompt = Prompt::new(
314− ":".to_owned(),
315− |_input: &str| None, // completion
316− |editor: &mut Editor, input: &str| match input {
317− "q" => editor.should_close = true,
318− _ => (),
319− },
320− );
321−
322− // set_prompt(prompt)
323−}
324−
325310// TODO: I, A, o and O can share a lot of the primitives.
326311
327312// calculate line numbers for each selection range
helix-view/src/keymap.rs−1
@@ -163,7 +163,6 @@ pub fn default() -> Keymaps {
163163 vec![key!('p')] => commands::paste,
164164 vec![key!('>')] => commands::indent,
165165 vec![key!('<')] => commands::unindent,
166− vec![key!(':')] => commands::command_mode,
167166 vec![Key {
168167 code: KeyCode::Esc,
169168 modifiers: Modifiers::NONE
helix-view/src/prompt.rs+7−2
@@ -1,5 +1,4 @@
1−use crate::commands;
2−use crate::{Editor, View};
1+use crate::Editor;
32use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
43use std::string::String;
54
@@ -91,6 +90,12 @@ impl Prompt {
9190 code: KeyCode::Enter,
9291 ..
9392 } => (self.callback_fn)(editor, &self.line),
93+ KeyEvent {
94+ code: KeyCode::Tab, ..
95+ } => {
96+ let _completion = (self.completion_fn)(&self.line);
97+ }
98+
9499 _ => (),
95100 }
96101 }