diff --git a/key_windows.go b/key_windows.go index a5dbfc832c..b693efd655 100644 --- a/key_windows.go +++ b/key_windows.go @@ -39,9 +39,19 @@ func readConInputs(ctx context.Context, msgsch chan<- Msg, con windows.Handle) e } for i := 0; i < int(e.RepeatCount); i++ { + eventKeyType := keyType(e) + var runes []rune + + // Add the character only if the key type is an actual character and not a control sequence. + // This mimics the behavior in readAnsiInputs where the character is also removed. + // We don't need to handle KeySpace here. See the comment in keyType(). + if eventKeyType == KeyRunes { + runes = []rune{e.Char} + } + msgs = append(msgs, KeyMsg{ - Type: keyType(e), - Runes: []rune{e.Char}, + Type: eventKeyType, + Runes: runes, Alt: e.ControlKeyState.Contains(coninput.LEFT_ALT_PRESSED | coninput.RIGHT_ALT_PRESSED), }) }