aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/input.rs')
-rw-r--r--helix-view/src/input.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-view/src/input.rs b/helix-view/src/input.rs
index 9fa679df..a7f526ba 100644
--- a/helix-view/src/input.rs
+++ b/helix-view/src/input.rs
@@ -116,6 +116,8 @@ pub(crate) mod keys {
pub(crate) const ESC: &str = "esc";
pub(crate) const SPACE: &str = "space";
pub(crate) const MINUS: &str = "minus";
+ pub(crate) const LESS_THAN: &str = "lt";
+ pub(crate) const GREATER_THAN: &str = "gt";
}
impl fmt::Display for KeyEvent {
@@ -156,6 +158,8 @@ impl fmt::Display for KeyEvent {
KeyCode::Esc => f.write_str(keys::ESC)?,
KeyCode::Char(' ') => f.write_str(keys::SPACE)?,
KeyCode::Char('-') => f.write_str(keys::MINUS)?,
+ KeyCode::Char('<') => f.write_str(keys::LESS_THAN)?,
+ KeyCode::Char('>') => f.write_str(keys::GREATER_THAN)?,
KeyCode::F(i) => f.write_fmt(format_args!("F{}", i))?,
KeyCode::Char(c) => f.write_fmt(format_args!("{}", c))?,
};
@@ -228,6 +232,8 @@ impl std::str::FromStr for KeyEvent {
keys::ESC => KeyCode::Esc,
keys::SPACE => KeyCode::Char(' '),
keys::MINUS => KeyCode::Char('-'),
+ keys::LESS_THAN => KeyCode::Char('<'),
+ keys::GREATER_THAN => KeyCode::Char('>'),
single if single.chars().count() == 1 => KeyCode::Char(single.chars().next().unwrap()),
function if function.len() > 1 && function.starts_with('F') => {
let function: String = function.chars().skip(1).collect();
@@ -548,8 +554,6 @@ mod test {
#[test]
fn parsing_unsupported_named_keys() {
- assert!(str::parse::<KeyEvent>("lt").is_err());
- assert!(str::parse::<KeyEvent>("gt").is_err());
assert!(str::parse::<KeyEvent>("plus").is_err());
assert!(str::parse::<KeyEvent>("percent").is_err());
assert!(str::parse::<KeyEvent>("semicolon").is_err());