diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-25 19:11:22 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-25 19:11:22 +0200 |
| commit | 2cbc78d4fcc1f14bc9aba3d27e69a77fbde030a6 (patch) | |
| tree | 612c3f4c34ba11dc98ea0f28b4d5b1d00c0054f7 /keybinds/test_binds.js | |
| parent | ea063fa984ef775950c840013462a49355576d0b (diff) | |
| download | quickshell-2cbc78d4fcc1f14bc9aba3d27e69a77fbde030a6.tar.gz quickshell-2cbc78d4fcc1f14bc9aba3d27e69a77fbde030a6.zip | |
fix(keybinds): survive group names shadowing Object.prototype
A description like "toString: X" made byName["toString"] resolve to
the inherited Object.prototype.toString instead of undefined, so the
group was never created and .rows.push threw. Object.create(null)
gives byName no prototype to shadow.
Also note in a comment that CAPS/MOD2/MOD3/MOD5 modmask bits are not
decoded and silently drop from the combo string.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'keybinds/test_binds.js')
| -rw-r--r-- | keybinds/test_binds.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/keybinds/test_binds.js b/keybinds/test_binds.js index 9be1dea..81f9108 100644 --- a/keybinds/test_binds.js +++ b/keybinds/test_binds.js @@ -42,4 +42,10 @@ assert.deepStrictEqual(B.group([ { name: "Undescribed", rows: [{ keys: "SUPER + s", label: "no description" }] }, ]); +// A group name matching an Object.prototype property must not resolve to +// the inherited value instead of creating a new group. +assert.deepStrictEqual(B.group([ + { modmask: 64, key: "z", description: "toString: Weird" }, +]), [{ name: "toString", rows: [{ keys: "SUPER + z", label: "Weird" }] }]); + console.log("ok"); |
