Skip to content

Commit

Permalink
Always remove shift modifier for KeySpace
Browse files Browse the repository at this point in the history
  • Loading branch information
Kavantix committed Jan 10, 2022
1 parent 12f0b02 commit 4a24126
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tcell_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ func pollEvent() gocuiEvent {
ch = tev.Rune()
if ch == ' ' {
// special handling for spacebar
k = 32 // tcell keys ends at 31 or starts at 256
k = tcell.Key(KeySpace) // tcell keys ends at 31 or starts at 256
ch = rune(0)
}
}
mod := tev.Modifiers()
// remove control modifier and setup special handling of ctrl+spacebar, etc.
if mod == tcell.ModCtrl && k == 32 {
if mod == tcell.ModCtrl && k == tcell.Key(KeySpace) {
mod = 0
ch = rune(0)
k = tcell.KeyCtrlSpace
} else if mod == tcell.ModCtrl || mod == tcell.ModShift && ch != 0 {
} else if mod == tcell.ModCtrl || mod == tcell.ModShift && (ch != 0 || k == tcell.Key(KeySpace)) {
// remove Ctrl or Shift if specified
// - shift - will be translated to the final code of rune
// - ctrl - is translated in the key
Expand Down

0 comments on commit 4a24126

Please sign in to comment.