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

[bug] (apparently), keybinding for <any> filter is called endlessly without any key typed #1928

Open
zokrezyl opened this issue Oct 12, 2024 · 2 comments

Comments

@zokrezyl
Copy link

Hi,

am not sure if this is a bug or feature, but the keybinding filtering function is called enndlesly.

I wanted to use it to have an overview of the keybindings and implement a plugin like the nvim "which-key" plugin.

    @Condition
    def unasigned_filter():
        print("filter called")
        return True #does not matter if I return True or False

    @bindings.add("<any>", filter=unasigned_filter)
    def _(event):
        return

thanks
Z

@zokrezyl
Copy link
Author

key_processor.py arround line 126
output;

keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)
keys (<Keys.CPRResponse: '<cursor-position-response>'>,)

        keys = tuple(k.key for k in key_presses)
        print("keys", keys)

        # Try match, with mode flag
        return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]

@zokrezyl
Copy link
Author

zokrezyl commented Oct 12, 2024

Some other suggestions/questions

The filter should receive the event. Most cases is redundant, but in case

And a question:

given that in the filter I do not have the event, cannot do what I wanted to do.

in the keybinding, is it possible to add back the event to the event queue?

Key binding for in vi mode would be also very usefull

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

No branches or pull requests

1 participant