dmauro / Keypress

A keyboard input capturing utility in which any key can be a modifier key.
http://dmauro.github.io/Keypress/
Apache License 2.0
3.18k stars 313 forks source link

Untrimmed key combination string silently causes issues #155

Open SneakySensei opened 1 year ago

SneakySensei commented 1 year ago

If you pass an untrimmed string to any of the combo registration functions, it splits that without trimming which results in an invalid key combination.

Eg:

listener.simple_combo(" r", function() {
    console.log("This function is never called");
});

This happens because the combo " r" gets split into ["", "r"] which is not a valid combo. The library should trim the combo before passing it to the split function.

SneakySensei commented 1 year ago

I can take this up if this is a valid fix. @dmauro