def _create_keybindings_registry(self):
registry = load_key_bindings_for_prompt()
for keystroke, callback in self.keybindings:
@registry.add_binding(keystroke)
def _(event):
"""
We use ``run_in_terminal``, because that ensures that the prompt is
hidden right before something gets printed and it's drawn again
after it. (Otherwise this would destroy the output.)
"""
event.cli.run_in_terminal(lambda: callback(None))
return registry
评论列表
文章目录