Skip to content

Commit

Permalink
fix(input): kitty: handle ModShift|ModCapsLock as uppercase (#335)
Browse files Browse the repository at this point in the history
This fixes an issue when both shift and caps-lock are on at the same
time. In this case, the key should be treated as uppercase as if one
of the two was pressed.
  • Loading branch information
aymanbagabas authored Jan 16, 2025
1 parent ef082e2 commit b39ca84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions input/kitty.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,12 @@ func parseKittyKeyboard(csi *ansi.CsiSequence) (Event Event) {
}

if len(key.Text) == 0 && unicode.IsPrint(key.Code) &&
(key.Mod <= ModShift || key.Mod == ModCapsLock) {
(key.Mod <= ModShift || key.Mod == ModCapsLock || key.Mod == ModShift|ModCapsLock) {
if key.Mod == 0 {
key.Text = string(key.Code)
} else {
desiredCase := unicode.ToLower
if key.Mod == ModShift || key.Mod == ModCapsLock {
if key.Mod.Contains(ModShift) || key.Mod.Contains(ModCapsLock) {
desiredCase = unicode.ToUpper
}
if key.ShiftedCode != 0 {
Expand Down

0 comments on commit b39ca84

Please sign in to comment.