##// END OF EJS Templates
Do no precompute when using vi mode.
Matthias Bussonnier -
Show More
@@ -377,12 +377,24 b' class TerminalInteractiveShell(InteractiveShell):'
377 """
377 """
378 Return the current layout option for the current Terminal InteractiveShell
378 Return the current layout option for the current Terminal InteractiveShell
379 """
379 """
380 def get_message():
381 return PygmentsTokens(self.prompts.in_prompt_tokens())
382
383 if self.editing_mode == 'emacs':
384 # with emacs mode the prompt is (usually) static, so we call only
385 # the function once. With VI mode it can toggle between [ins] and
386 # [nor] so we can't precompute.
387 # here I'm going to favor the default keybinding which almost
388 # everybody uses to decrease CPU usage.
389 # if we have issues with users with custom Prompts we can see how to
390 # work around this.
391 get_message = get_message()
380
392
381 return {
393 return {
382 'complete_in_thread': False,
394 'complete_in_thread': False,
383 'lexer':IPythonPTLexer(),
395 'lexer':IPythonPTLexer(),
384 'reserve_space_for_menu':self.space_for_menu,
396 'reserve_space_for_menu':self.space_for_menu,
385 'message': PygmentsTokens(self.prompts.in_prompt_tokens()),
397 'message': get_message,
386 'prompt_continuation': (
398 'prompt_continuation': (
387 lambda width, lineno, is_soft_wrap:
399 lambda width, lineno, is_soft_wrap:
388 PygmentsTokens(self.prompts.continuation_prompt_tokens(width))),
400 PygmentsTokens(self.prompts.continuation_prompt_tokens(width))),
General Comments 0
You need to be logged in to leave comments. Login now