@@ -116,6 +116,8 @@ pub(crate) mod keys {
116 pub(crate) const ESC: &str = "esc";
116 pub(crate) const ESC: &str = "esc";
117 pub(crate) const SPACE: &str = "space";
117 pub(crate) const SPACE: &str = "space";
118 pub(crate) const MINUS: &str = "minus";
118 pub(crate) const MINUS: &str = "minus";
119+ pub(crate) const LESS_THAN: &str = "lt";
120+ pub(crate) const GREATER_THAN: &str = "gt";
121impl fmt::Display for KeyEvent {
123impl fmt::Display for KeyEvent {
@@ -156,6 +158,8 @@ impl fmt::Display for KeyEvent {
156 KeyCode::Esc => f.write_str(keys::ESC)?,
158 KeyCode::Esc => f.write_str(keys::ESC)?,
157 KeyCode::Char(' ') => f.write_str(keys::SPACE)?,
159 KeyCode::Char(' ') => f.write_str(keys::SPACE)?,
158 KeyCode::Char('-') => f.write_str(keys::MINUS)?,
160 KeyCode::Char('-') => f.write_str(keys::MINUS)?,
161+ KeyCode::Char('<') => f.write_str(keys::LESS_THAN)?,
162+ KeyCode::Char('>') => f.write_str(keys::GREATER_THAN)?,
159 KeyCode::F(i) => f.write_fmt(format_args!("F{}", i))?,
163 KeyCode::F(i) => f.write_fmt(format_args!("F{}", i))?,
160 KeyCode::Char(c) => f.write_fmt(format_args!("{}", c))?,
164 KeyCode::Char(c) => f.write_fmt(format_args!("{}", c))?,
@@ -228,6 +232,8 @@ impl std::str::FromStr for KeyEvent {
228 keys::ESC => KeyCode::Esc,
232 keys::ESC => KeyCode::Esc,
229 keys::SPACE => KeyCode::Char(' '),
233 keys::SPACE => KeyCode::Char(' '),
230 keys::MINUS => KeyCode::Char('-'),
234 keys::MINUS => KeyCode::Char('-'),
235+ keys::LESS_THAN => KeyCode::Char('<'),
236+ keys::GREATER_THAN => KeyCode::Char('>'),
231 single if single.chars().count() == 1 => KeyCode::Char(single.chars().next().unwrap()),
237 single if single.chars().count() == 1 => KeyCode::Char(single.chars().next().unwrap()),
232 function if function.len() > 1 && function.starts_with('F') => {
238 function if function.len() > 1 && function.starts_with('F') => {
233 let function: String = function.chars().skip(1).collect();
239 let function: String = function.chars().skip(1).collect();
@@ -548,8 +554,6 @@ mod test {
550 fn parsing_unsupported_named_keys() {
556 fn parsing_unsupported_named_keys() {
551− assert!(str::parse::<KeyEvent>("lt").is_err());
552− assert!(str::parse::<KeyEvent>("gt").is_err());
553 assert!(str::parse::<KeyEvent>("plus").is_err());
557 assert!(str::parse::<KeyEvent>("plus").is_err());
554 assert!(str::parse::<KeyEvent>("percent").is_err());
558 assert!(str::parse::<KeyEvent>("percent").is_err());
555 assert!(str::parse::<KeyEvent>("semicolon").is_err());
559 assert!(str::parse::<KeyEvent>("semicolon").is_err());