1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 03:39:16 +03:00

lineedit: add ctrl-L repaint/refresh binding

This commit is contained in:
Wez Furlong 2019-05-27 07:13:37 -07:00
parent 90fece7b27
commit 8a74eff72e

View File

@ -27,6 +27,7 @@
//! Ctrl-F, Right | Move cursor one grapheme to the right //! Ctrl-F, Right | Move cursor one grapheme to the right
//! Ctrl-H, Backspace | Delete the grapheme to the left of the cursor //! 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-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::caps::{Capabilities, ProbeHintsBuilder};
use crate::input::{InputEvent, KeyCode, KeyEvent, Modifiers}; use crate::input::{InputEvent, KeyCode, KeyEvent, Modifiers};
use crate::surface::{Change, Position}; use crate::surface::{Change, Position};
@ -221,6 +222,13 @@ impl<T: Terminal> LineEditor<T> {
self.line.insert_str(self.cursor, &text); self.line.insert_str(self.cursor, &text);
self.cursor += text.len(); self.cursor += text.len();
} }
InputEvent::Key(KeyEvent {
key: KeyCode::Char('L'),
modifiers: Modifiers::CTRL,
}) => {
self.terminal
.render(&[Change::ClearScreen(Default::default())])?;
}
_ => {} _ => {}
} }
self.render()?; self.render()?;