Skip to content

Commit 023426a

Browse files
authored
Merge pull request #728 from go-vgo/bitmap-pr
Fix: return key
2 parents c431c8f + d34a149 commit 023426a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

key.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ func toErr(str *C.char) error {
486486
return errors.New(gstr)
487487
}
488488

489-
func appendShift(key string, len1 int, args ...interface{}) []interface{} {
489+
func appendShift(key string, len1 int, args ...interface{}) (string, []interface{}) {
490490
if len(key) > 0 && unicode.IsUpper([]rune(key)[0]) {
491491
args = append(args, "shift")
492492
}
@@ -499,7 +499,7 @@ func appendShift(key string, len1 int, args ...interface{}) []interface{} {
499499
}
500500
}
501501

502-
return args
502+
return key, args
503503
}
504504

505505
// KeyTap taps the keyboard code;
@@ -520,7 +520,7 @@ func appendShift(key string, len1 int, args ...interface{}) []interface{} {
520520
// robotgo.KeyTap("k", pid int)
521521
func KeyTap(key string, args ...interface{}) error {
522522
var keyArr []string
523-
args = appendShift(key, 0, args...)
523+
key, args = appendShift(key, 0, args...)
524524

525525
pid := 0
526526
if len(args) > 0 {
@@ -563,7 +563,7 @@ func getToggleArgs(args ...interface{}) (pid int, keyArr []string) {
563563
// robotgo.KeyToggle("a", "up", "alt", "cmd")
564564
// robotgo.KeyToggle("k", pid int)
565565
func KeyToggle(key string, args ...interface{}) error {
566-
args = appendShift(key, 1, args...)
566+
key, args = appendShift(key, 1, args...)
567567
pid, keyArr := getToggleArgs(args...)
568568
return keyToggles(key, keyArr, pid)
569569
}

0 commit comments

Comments
 (0)