Skip to content

Commit

Permalink
fixed stop routine
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Jun 5, 2022
1 parent 9e4bed4 commit 3a7bcb1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions keyboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func Listen(onKeyPress func(key keys.Key) (stop bool, err error)) error {
stopRoutine, _ = onKeyPress(keyInfo)
if stopRoutine {
inputTTY.Close()
onKeyPress(keys.Key{Code: keys.Null})
}
}
}
Expand All @@ -96,6 +97,10 @@ func Listen(onKeyPress func(key keys.Key) (stop bool, err error)) error {
return err
}

if key.Code == keys.Null {
return nil
}

stop, err := onKeyPress(key)
if err != nil {
return err
Expand Down

0 comments on commit 3a7bcb1

Please sign in to comment.