Skip to content

Commit

Permalink
Prevent single CTRL to insert space.
Browse files Browse the repository at this point in the history
  • Loading branch information
apognu committed Nov 5, 2023
1 parent 0cb0e35 commit de5f73b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,23 @@ pub async fn handle(greeter: Arc<RwLock<Greeter>>, input: KeyEvent, ipc: Ipc) ->
},

// Handle free-form entry of characters.
KeyEvent { code: KeyCode::Char(c), .. } => insert_key(&mut greeter, c).await,
KeyEvent {
code: KeyCode::Char(c),
modifiers: KeyModifiers::NONE,
..
} => insert_key(&mut greeter, c).await,

// Handle deletion of characters.
KeyEvent { code: KeyCode::Backspace, .. } | KeyEvent { code: KeyCode::Delete, .. } => delete_key(&mut greeter, input.code).await,
KeyEvent {
code: KeyCode::Backspace,
modifiers: KeyModifiers::NONE,
..
}
| KeyEvent {
code: KeyCode::Delete,
modifiers: KeyModifiers::NONE,
..
} => delete_key(&mut greeter, input.code).await,

_ => {}
}
Expand Down

0 comments on commit de5f73b

Please sign in to comment.