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

added hexCodes for wsl-powershell Home and End keys #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions input.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
"1b4f42": {Code: keys.Down, AltPressed: false},
"1b4f43": {Code: keys.Right, AltPressed: false},
"1b4f44": {Code: keys.Left, AltPressed: false},
"1b5b46": {Code: keys.End, AltPressed: false},
"1b5b48": {Code: keys.Home, AltPressed: false},
}

func getKeyPress() (keys.Key, error) {
Expand Down Expand Up @@ -199,7 +201,7 @@
// Remove the initial escape sequence
c, _ := utf8.DecodeRune(buf[1:])
if c == utf8.RuneError {
return keys.Key{}, fmt.Errorf("could not decode rune after removing initial escape sequence")

Check failure on line 204 in input.go

View workflow job for this annotation

GitHub Actions / lint

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"could not decode rune after removing initial escape sequence\")" (err113)
}

return keys.Key{AltPressed: true, Code: keys.RuneKey, Runes: []rune{c}}, nil
Expand All @@ -219,7 +221,7 @@
}

if len(runes) == 0 {
return keys.Key{}, fmt.Errorf("received 0 runes from stdin")

Check failure on line 224 in input.go

View workflow job for this annotation

GitHub Actions / lint

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"received 0 runes from stdin\")" (err113)
} else if len(runes) > 1 {
return keys.Key{Code: keys.RuneKey, Runes: runes}, nil
}
Expand Down
Loading