Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vis-lua: raise an error when mapping to invalid handler types #1125

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

devkarthin
Copy link
Contributor

When passing an invalid handler type (such as nil) to Vis:map/Window:map, the editor would map the key to an empty (zeroed) KeyBinding that would cause itself to become unresponsive when processing the corresponding key.

@mcepl
Copy link
Contributor

mcepl commented Sep 7, 2023

Is there some way how to add a test for this?

@devkarthin
Copy link
Contributor Author

Is there some way how to add a test for this?

Could you clarify what you mean by that?

@mcepl
Copy link
Contributor

mcepl commented Sep 30, 2023

Is there some way how to add a test for this?

Could you clarify what you mean by that?

You know we have the test suite in https://github.com/martanne/vis-test/, right?

Copy link
Collaborator

@rnpnr rnpnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Karthin,

Sorry I meant to reply after the build was fixed. Comments inline.

vis-lua.c Outdated Show resolved Hide resolved
When passing an invalid handler type (i.e., any type that isn't a
string, function, or KeyAction) to Vis:map/Window:map, the editor would
map the key to an empty (zeroed) KeyBinding struct.  vis_keys_process()
doesn't take this into account, so the key is never consumed from
the input queue, causing the editor to get stuck in an infinite loop.
@rnpnr rnpnr merged commit 3d83d77 into martanne:master Oct 5, 2023
24 checks passed
@rnpnr
Copy link
Collaborator

rnpnr commented Oct 5, 2023

Thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants