@@ -1,14 +1,14 @@
1−use clap::ArgMatches as Args;
1+use crate::{
2−use helix_core::{indent::TAB_WIDTH, syntax::HighlightEvent, Position, Range, State};
6 keymap::{self, Keymaps},
3 keymap::{self, Keymaps},
8− Document, Editor, Theme, View,
5+use clap::ArgMatches as Args;
6+use helix_core::{indent::TAB_WIDTH, syntax::HighlightEvent, Position, Range, State};
8+use helix_view::{document::Mode, Document, Editor, Theme, View};
11use crate::compositor::{Component, Compositor, EventResult};
10use crate::compositor::{Component, Compositor, EventResult};
11+use crate::prompt::Prompt;
13use log::{debug, info};
13use log::{debug, info};
@@ -395,23 +395,16 @@ impl Component for EditorView {
395 EventResult::Consumed(None)
395 EventResult::Consumed(None)
397 Event::Key(event) => {
397 Event::Key(event) => {
398− // if there's a prompt, it takes priority
399− if let Some(prompt) = &mut self.prompt {
403− .handle_input(event, &mut self.editor);
404− EventResult::Consumed(None)
405− } else if let Some(view) = self.editor.view_mut() {
398+ if let Some(view) = self.editor.view_mut() {
406 let keys = vec![event];
399 let keys = vec![event];
407 // TODO: sequences (`gg`)
400 // TODO: sequences (`gg`)
408 // TODO: handle count other than 1
401 // TODO: handle count other than 1
409 match view.doc.mode() {
402 match view.doc.mode() {
410 Mode::Insert => {
403 Mode::Insert => {
411 if let Some(command) = self.keymap[&Mode::Insert].get(&keys) {
404 if let Some(command) = self.keymap[&Mode::Insert].get(&keys) {
412− let mut cx = helix_view::commands::Context {
405+ let mut cx = commands::Context {
414− executor: executor,
407+ executor,
415 count: 1,
408 count: 1,
@@ -421,9 +414,9 @@ impl Component for EditorView {
422 } = event
415 } = event
424− let mut cx = helix_view::commands::Context {
417+ let mut cx = commands::Context {
426− executor: executor,
419+ executor,
427 count: 1,
420 count: 1,
429 commands::insert::insert_char(&mut cx, c);
422 commands::insert::insert_char(&mut cx, c);
@@ -488,9 +481,9 @@ impl Component for EditorView {
489 // HAXX: special casing for command mode
482 // HAXX: special casing for command mode
490 } else if let Some(command) = self.keymap[&Mode::Normal].get(&keys) {
483 } else if let Some(command) = self.keymap[&Mode::Normal].get(&keys) {
491− let mut cx = helix_view::commands::Context {
484+ let mut cx = commands::Context {
493− executor: executor,
486+ executor,
494 count: 1,
487 count: 1,
496 command(&mut cx);
489 command(&mut cx);
@@ -501,9 +494,9 @@ impl Component for EditorView {
502 mode => {
495 mode => {
503 if let Some(command) = self.keymap[&mode].get(&keys) {
496 if let Some(command) = self.keymap[&mode].get(&keys) {
504− let mut cx = helix_view::commands::Context {
497+ let mut cx = commands::Context {
506− executor: executor,
499+ executor,
507 count: 1,
500 count: 1,
509 command(&mut cx);
502 command(&mut cx);
@@ -530,13 +523,6 @@ impl Component for EditorView {
530 let theme_ref = unsafe { &*(&self.editor.theme as *const Theme) };
523 let theme_ref = unsafe { &*(&self.editor.theme as *const Theme) };
531 if let Some(view) = self.editor.view_mut() {
524 if let Some(view) = self.editor.view_mut() {
532 renderer.render_view(view, viewport, theme_ref);
525 renderer.render_view(view, viewport, theme_ref);
533− if let Some(prompt) = &self.prompt {
534− if prompt.should_close {
537− renderer.render_prompt(view, prompt, theme_ref);
542 // TODO: drop unwrap
528 // TODO: drop unwrap
@@ -562,7 +548,6 @@ impl<'a> Application<'a> {
562 renderer,
548 renderer,
563 // TODO; move to state
549 // TODO; move to state
564 compositor,
550 compositor,
567 executor,
552 executor,
568 language_server,
553 language_server,