diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-07-24 10:31:06 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-07-24 10:31:06 -0400 |
commit | f39c918bb7e454d622a06d25096f68e19d3fc915 (patch) | |
tree | 1a7d18e263c7f37d4f092e900393bc97ce297019 /src/util | |
parent | aaa99c2d98a8dfa791813c350677af59a896068e (diff) |
make ambiguous command message more clear
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/mod.rs | 1 | ||||
-rw-r--r-- | src/util/to_string.rs | 46 |
2 files changed, 0 insertions, 47 deletions
diff --git a/src/util/mod.rs b/src/util/mod.rs index 7e43d3a..c7ad758 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -8,5 +8,4 @@ pub mod process; pub mod search; pub mod string; pub mod style; -pub mod to_string; pub mod unix; diff --git a/src/util/to_string.rs b/src/util/to_string.rs deleted file mode 100644 index cbfffb0..0000000 --- a/src/util/to_string.rs +++ /dev/null @@ -1,46 +0,0 @@ -use termion::event::{Event, Key, MouseEvent}; - -pub trait ToString { - fn to_string(&self) -> String; -} - -impl ToString for Key { - fn to_string(&self) -> String { - match *self { - Key::Char(c) => format!("{}", c), - Key::Ctrl(c) => format!("ctrl+{}", c), - Key::Left => "arrow_left".to_string(), - Key::Right => "arrow_right".to_string(), - Key::Up => "arrow_up".to_string(), - Key::Down => "arrow_down".to_string(), - Key::Backspace => "backspace".to_string(), - Key::Home => "home".to_string(), - Key::End => "end".to_string(), - Key::PageUp => "page_up".to_string(), - Key::PageDown => "page_down".to_string(), - Key::BackTab => "backtab".to_string(), - Key::Insert => "insert".to_string(), - Key::Delete => "delete".to_string(), - Key::Esc => "escape".to_string(), - Key::F(i) => format!("f{}", i), - k => format!("{:?}", k), - } - } -} - -impl ToString for MouseEvent { - fn to_string(&self) -> String { - let k = *self; - format!("{:?}", k) - } -} - -impl ToString for Event { - fn to_string(&self) -> String { - match self { - Event::Key(key) => key.to_string(), - Event::Mouse(mouse) => mouse.to_string(), - Event::Unsupported(v) => format!("{:?}", v), - } - } -} |