async def do_in_terminal() -> None: async with in_terminal(): result = await history.app.run_async() if result is not None: self.default_buffer.text = result app.vi_state.input_mode = InputMode.INSERT
async def _(event): """ Example of asyncio coroutine as a key binding. """ try: for i in range(5): async with in_terminal(): print("hello") await asyncio.sleep(1) except asyncio.CancelledError: print("Prompt terminated before we completed.")
async def write_line_async(self, text): text = self._cleanup_text(text) text = text.strip() async with in_terminal(): prompt_toolkit.print_formatted_text(FormattedText([(self._async_output_color, text)]), end='\n')
async def print_context(event): async with in_terminal(): pprint.pprint(api.format_dict(self.root_node.context))
async def print_flange_info(event): async with in_terminal(): self.root_node.flange.info()