Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(windows): Fix coninput not handling control sequences #1041

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions key_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
}
Expand Down
Loading