Skip to content

Commit

Permalink
fix: dead keys support
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardz1 authored and jackpot51 committed Oct 7, 2024
1 parent 64e95eb commit aa1824d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/terminal_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ where
Event::Keyboard(KeyEvent::KeyPressed {
key: Key::Named(named),
modifiers,
text,
..
}) if state.is_focused => {
for key_bind in self.key_binds.keys() {
Expand Down Expand Up @@ -778,11 +779,15 @@ where
status = Status::Captured;
}
Named::Space => {
// Keep this instead of hardcoding the space to allow for dead keys
let character = text.and_then(|c| c.chars().next()).unwrap_or_default();

if modifiers.control() {
// Send NUL character (\x00) for Ctrl + Space
terminal.input_scroll(b"\x00".to_vec());
} else {
terminal.input_scroll(format!("{}{}", alt_prefix, " ").into_bytes());
terminal
.input_scroll(format!("{}{}", alt_prefix, character).into_bytes());
}
status = Status::Captured;
}
Expand Down

0 comments on commit aa1824d

Please sign in to comment.