These are chat archives for ipython/ipython

10th
Nov 2018
Reuben Morais
@reuben
Nov 10 2018 23:20
hi all. I'm porting my fancy zsh prompt to IPython so I can use it as a shell, and I realized that the prompt class's in_prompt_tokens method gets called several times per second by prompt_toolkit
prompt_toolkit has a refresh_interval parameter that lets you configure how often it refreshes the UI, but we don't specify it and the default value is 0
but I tried simply passing a static token list instead of a callable and it seems to work just as well for me? I'm wondering why we need to pass in_prompt_tokens() as a callable to prompt_toolkit, there's probably some functionality I don't know about that requires it
note that the 'message' attribute is a function that calls Prompt.in_prompt_tokens. I replaced that with just: 'message': PygmentsTokens(self.prompts.in_prompt_tokens())