mirror of
https://github.com/hyprwm/hyprlang.git
synced 2026-02-04 18:40:26 +01:00
When parsing multiple special category blocks with different key values,
the second block would incorrectly overwrite the first instead of creating
a separate category entry.
Root cause:
When parsing a block like:
wallpaper {
monitor =
path = /path/image.png
}
wallpaper {
monitor = DP-1
path = /path/image.png
}
1. After closing the first block, `currentSpecialKey` resets to ""
2. When parsing `monitor = DP-1` in the second block, the code looks
for an existing category where key value == currentSpecialKey ("")
3. The first category's key value IS "", so it matches incorrectly
4. The second block overwrites the first, leaving only one category
The fix:
When looking for an existing category to reuse, check what field we're
parsing:
- If parsing the KEY field itself, match by the VALUE being set
- If parsing other fields, match by currentSpecialKey (existing behavior)
This ensures `monitor = DP-1` looks for a category with `monitor == "DP-1"`,
not `monitor == ""`, allowing empty string keys to work correctly alongside
non-empty keys.
This bug affects any hyprlang consumer using keyed special categories where
empty string is a valid key value (e.g., hyprpaper's wallpaper category
with `monitor =` for default/wildcard).
|
||
|---|---|---|
| .. | ||
| config | ||
| fuzz | ||
| parse | ||