lineedit: add ctrl-L repaint/refresh binding

This commit is contained in:
Wez Furlong committed 2019-05-27 07:14:39 -07:00
1 parent 90fece7b27
commit 8a74eff72e
1 file changed
+8
+8
View File
@@ -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<T: Terminal> LineEditor<T> {
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()?;