on master help sign in
wip
commit29cb33300b1486c778e9318e87e60c26695c2520 authorBlaž Hrastnik <blaz@mxxn.io> dateSat 12 Dec 2020, 20:18 (6 years ago) parentada3f92
1 file changed+2−8
helix-term/src/application.rs+2−8
helix-term/src/application.rs+2−8
@@ -336,6 +336,7 @@ impl Renderer {
336336 .draw(self.cache.diff(&self.surface).into_iter());
337337 // swap the buffer
338338 std::mem::swap(&mut self.surface, &mut self.cache);
339+ self.surface.reset(); // reset is faster than allocating new empty surface
339340 }
340341
341342 pub fn render_cursor(&mut self, view: &View, prompt: Option<&Prompt>, viewport: Rect) {
@@ -412,13 +413,6 @@ impl Component for EditorView {
412413 commands::insert::insert_char(&mut cx, c);
413414 }
414415 }
415− Mode::Normal => {
416− if let Some(command) = self.keymap[&Mode::Normal].get(&keys) {
417− command(&mut cx);
418−
419− // TODO: simplistic ensure cursor in view for now
420− }
421− }
422416 mode => {
423417 if let Some(command) = self.keymap[&mode].get(&keys) {
424418 command(&mut cx);
@@ -484,7 +478,6 @@ impl<'a> Application<'a> {
484478 }
485479
486480 fn render(&mut self) {
487− self.renderer.surface.reset(); // reset is faster than allocating new empty surface
488481 let mut cx = crate::compositor::Context {
489482 editor: &mut self.editor,
490483 executor: &self.executor,
@@ -543,6 +536,7 @@ impl<'a> Application<'a> {
543536
544537 if should_redraw {
545538 self.render();
539+ // calling render twice here fixes it for some reason
546540 }
547541 }
548542