diff --git a/helix-view/src/input.rs b/helix-view/src/input.rs index 9fa679dff..a7f526ba7 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::("lt").is_err()); - assert!(str::parse::("gt").is_err()); assert!(str::parse::("plus").is_err()); assert!(str::parse::("percent").is_err()); assert!(str::parse::("semicolon").is_err());