Skip to content
Myr

Fix Ctrl+Space key combination to emit CtrlSpace instead of Rune ' '

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Vlastimil Ovčáčík · committed by Junegunn Choi · parent f3dc8a1 · Browse files · 2 files+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−1 removed

  • other:+4 added−1 removed

2 files+4 added−1 removed

modified:src/tui/tcell_test.go+1 added-1 removed
89 unmodified lines
9091 // section 2: Ctrl+[ \]_]92 {giveKey{tcell.KeyCtrlSpace, rune(tcell.KeyCtrlSpace), tcell.ModCtrl}, wantKey{CtrlSpace, 0, nil}}, // fabricated93 {giveKey{tcell.KeyNUL, rune(tcell.KeyNUL), tcell.ModNone}, wantKey{CtrlSpace, 0, nil}}, // fabricated, unhandled94 {giveKey{tcell.KeyRune, ' ', tcell.ModCtrl}, wantKey{Rune, ' ', nil}}, // actual Ctrl+' '94 {giveKey{tcell.KeyRune, ' ', tcell.ModCtrl}, wantKey{CtrlSpace, 0, nil}}, // actual Ctrl+' '95 {giveKey{tcell.KeyCtrlBackslash, rune(tcell.KeyCtrlBackslash), tcell.ModCtrl}, wantKey{CtrlBackSlash, 0, nil}},96 {giveKey{tcell.KeyCtrlRightSq, rune(tcell.KeyCtrlRightSq), tcell.ModCtrl}, wantKey{CtrlRightBracket, 0, nil}},97 {giveKey{tcell.KeyCtrlUnderscore, rune(tcell.KeyCtrlUnderscore), tcell.ModShift | tcell.ModCtrl}, wantKey{CtrlSlash, 0, nil}},98
293 unmodified lines
modified:src/tui/tcell.go+3 added
394 unmodified lines
395 case tcell.KeyRune:396 r := ev.Rune()397398 switch {399 // translate native key events to ascii control characters400 case r == ' ' && ctrl:401 return Event{CtrlSpace, 0, nil}402 // handle AltGr characters403 case ctrlAlt:404 return Event{Rune, r, nil} // dropping modifiers405 // simple characters (possibly with modifier)
262 unmodified lines