From 8a74eff72e729cc8dc2c3e2997f8bdd0e1eaafa8 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 27 May 2019 07:13:37 -0700 Subject: [PATCH] lineedit: add ctrl-L repaint/refresh binding --- termwiz/src/lineedit/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/termwiz/src/lineedit/mod.rs b/termwiz/src/lineedit/mod.rs index 10fb52ff6..1b84916aa 100644 --- a/termwiz/src/lineedit/mod.rs +++ b/termwiz/src/lineedit/mod.rs @@ -27,6 +27,7 @@ //! Ctrl-F, Right | Move cursor one grapheme to the right //! Ctrl-H, Backspace | Delete the grapheme to the left of the cursor //! Ctrl-J, Ctrl-M, Enter | Finish line editing and accept the current line +//! Ctrl-L | Move the cursor to the top left, clear screen and repaint use crate::caps::{Capabilities, ProbeHintsBuilder}; use crate::input::{InputEvent, KeyCode, KeyEvent, Modifiers}; use crate::surface::{Change, Position}; @@ -221,6 +222,13 @@ impl LineEditor { self.line.insert_str(self.cursor, &text); self.cursor += text.len(); } + InputEvent::Key(KeyEvent { + key: KeyCode::Char('L'), + modifiers: Modifiers::CTRL, + }) => { + self.terminal + .render(&[Change::ClearScreen(Default::default())])?; + } _ => {} } self.render()?;