-
Notifications
You must be signed in to change notification settings - Fork 752
Open
Description
Hi,
I noticed a potential indentation issue in the documentation for ConditionalKeyBindings:
The bindings = ConditionalKeyBindings(...) line appears to be indented under the is_active() function. This could confuse readers, as it implies the line is part of the function, which would result in it not being executed after the return statement.
Here’s the snippet in question (with the indentation issue):
from prompt_toolkit.key_binding import ConditionalKeyBindings
@Condition
def is_active():
" Only activate key binding on the second half of each minute. "
return datetime.datetime.now().second > 30
bindings = ConditionalKeyBindings(
key_bindings=my_bindings,
filter=is_active)
This would lead to the bindings = ... line not being executed. I believe the bindings = ... line should be outside the function like this:
@Condition
def is_active():
"Only activate key binding on the second half of each minute."
return datetime.datetime.now().second > 30
bindings = ConditionalKeyBindings(
key_bindings=my_bindings,
filter=is_active
)
Could you please confirm if this is indeed an error?
Thank you for your hard work on this fantastic library! 🙏
Best,
Joe
Metadata
Metadata
Assignees
Labels
No labels
