parent
9d4c301563
commit
28919898e9
1 changed files with 2 additions and 2 deletions
|
@ -15,10 +15,10 @@ pub struct KeyEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeyEvent {
|
impl KeyEvent {
|
||||||
/// If a character was pressed (without modifiers), return it.
|
/// If a character was pressed, return it.
|
||||||
pub fn char(&self) -> Option<char> {
|
pub fn char(&self) -> Option<char> {
|
||||||
match self.code {
|
match self.code {
|
||||||
KeyCode::Char(ch) if self.modifiers.is_empty() => Some(ch),
|
KeyCode::Char(ch) => Some(ch),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue