Skip to content

Commit

Permalink
Drop characters on windows on EnterKey event
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastronaut committed Jun 5, 2024
1 parent 7899f0f commit ae18b80
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions key_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,20 @@ func readConInputs(ctx context.Context, msgsch chan<- Msg, con windows.Handle) e
}

for i := 0; i < int(e.RepeatCount); i++ {
msgs = append(msgs, KeyMsg{
Type: keyType(e),
Runes: []rune{e.Char},
Alt: e.ControlKeyState.Contains(coninput.LEFT_ALT_PRESSED | coninput.RIGHT_ALT_PRESSED),
})
eventKeyType := keyType(e)
msg := KeyMsg{
Type: eventKeyType,
Alt: e.ControlKeyState.Contains(coninput.LEFT_ALT_PRESSED | coninput.RIGHT_ALT_PRESSED),
}

// readAnsiInputs doesn't send Runes on a message when the input matches
// a sequence. Let's keep that behavior here, too.
// TODO: Determine if other keys present similar issues
if eventKeyType != KeyEnter {
msg.Runes = []rune{e.Char}
}

msgs = append(msgs, msg)
}
case coninput.WindowBufferSizeEventRecord:
if e != ws {
Expand Down

0 comments on commit ae18b80

Please sign in to comment.