on master help sign in
fix warnings
ae8ff96Jan Hrastnik
helix-view/src/commands.rs−15
@@ -307,21 +307,6 @@ pub fn append_mode(view: &mut View, _count: usize) {
307 })
307 })
308}
308}
309
309
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−
325// TODO: I, A, o and O can share a lot of the primitives.
310// TODO: I, A, o and O can share a lot of the primitives.
326
311
327// calculate line numbers for each selection range
312// calculate line numbers for each selection range
helix-view/src/keymap.rs−1
@@ -163,7 +163,6 @@ pub fn default() -> Keymaps {
163 vec![key!('p')] => commands::paste,
163 vec![key!('p')] => commands::paste,
164 vec![key!('>')] => commands::indent,
164 vec![key!('>')] => commands::indent,
165 vec![key!('<')] => commands::unindent,
165 vec![key!('<')] => commands::unindent,
166− vec![key!(':')] => commands::command_mode,
167 vec![Key {
166 vec![Key {
168 code: KeyCode::Esc,
167 code: KeyCode::Esc,
169 modifiers: Modifiers::NONE
168 modifiers: Modifiers::NONE
helix-view/src/prompt.rs+7−2
@@ -1,5 +1,4 @@
1−use crate::commands;
1+use crate::Editor;
2−use crate::{Editor, View};
3use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
2use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
4use std::string::String;
3use std::string::String;
5
4
@@ -91,6 +90,12 @@ impl Prompt {
91 code: KeyCode::Enter,
90 code: KeyCode::Enter,
92 ..
91 ..
93 } => (self.callback_fn)(editor, &self.line),
92 } => (self.callback_fn)(editor, &self.line),
93+ KeyEvent {
94+ code: KeyCode::Tab, ..
95+ } => {
96+ let _completion = (self.completion_fn)(&self.line);
97+ }
98+
94 _ => (),
99 _ => (),
95 }
100 }
96 }
101 }