Fix keybindings menu Lua mock spinning on Lua 5.4+ ipairs - #11095
Open
yzzztech wants to merge 1 commit into
Open
Fix keybindings menu Lua mock spinning on Lua 5.4+ ipairs#11095yzzztech wants to merge 1 commit into
yzzztech wants to merge 1 commit into
Conversation
Lua 5.4+ makes ipairs consult __index. The mock's noop answered every integer key with itself, so iterating a mock value (e.g. hl.get_active_window().tags) looped forever and pegged a core. Return nil for numeric keys so ipairs/pairs terminate, while named keys still chain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11094
The keybindings menu's Lua bind scan hangs at 100% CPU when a config iterates a mock value with
ipairs/pairs. Lua 5.4 changedipairsto consult__index; the mock'snoopanswered every integer key with itself, soipairs(noop)looped forever (e.g. iteratinghl.get_active_window().tags).The fix makes
__indexreturnnilfor numeric keys so iteration terminates, while named keys still returnnoopso chaining (window.tags,:set_enabled(),hl.dsp.*) keeps working.Adds a regression test that walks
hl.get_active_window().tagsat config load — it hangs without the fix and passes with it.