diff --git a/xonsh/ptk/shell.py b/xonsh/ptk/shell.py index 76c1c5fca..5ffc1e58f 100644 --- a/xonsh/ptk/shell.py +++ b/xonsh/ptk/shell.py @@ -13,7 +13,6 @@ from pygments.token import Token from xonsh.base_shell import BaseShell from xonsh.tools import print_exception -from xonsh.prompt.base import partial_format_prompt from xonsh.pyghooks import (XonshLexer, partial_color_tokenize, xonsh_style_proxy) from xonsh.ptk.completer import PromptToolkitCompleter @@ -138,7 +137,7 @@ class PromptToolkitShell(BaseShell): """Returns a list of (token, str) tuples for the current prompt.""" p = builtins.__xonsh_env__.get('PROMPT') try: - p = partial_format_prompt(p) + p = self.prompt_formatter.format_prompt(p) except Exception: # pylint: disable=broad-except print_exception() toks = partial_color_tokenize(p) @@ -150,13 +149,13 @@ class PromptToolkitShell(BaseShell): prompt. """ p = builtins.__xonsh_env__.get('RIGHT_PROMPT') - # partial_format_prompt does handle empty strings properly, + # self.prompt_formatter.format_prompt does handle empty strings properly, # but this avoids descending into it in the common case of # $RIGHT_PROMPT == ''. if isinstance(p, str) and len(p) == 0: return [] try: - p = partial_format_prompt(p) + p = self.prompt_formatter.format_prompt(p) except Exception: # pylint: disable=broad-except print_exception() toks = partial_color_tokenize(p) @@ -167,13 +166,13 @@ class PromptToolkitShell(BaseShell): toolbar. """ p = builtins.__xonsh_env__.get('BOTTOM_TOOLBAR') - # partial_format_prompt does handle empty strings properly, + # self.prompt_formatter.format_prompt does handle empty strings properly, # but this avoids descending into it in the common case of # $TOOLBAR == ''. if isinstance(p, str) and len(p) == 0: return [] try: - p = partial_format_prompt(p) + p = self.prompt_formatter.format_prompt(p) except Exception: # pylint: disable=broad-except print_exception() toks = partial_color_tokenize(p) diff --git a/xonsh/readline_shell.py b/xonsh/readline_shell.py index e45296985..f084369d7 100644 --- a/xonsh/readline_shell.py +++ b/xonsh/readline_shell.py @@ -24,7 +24,7 @@ from xonsh.lazyjson import LazyJSON from xonsh.lazyasd import LazyObject from xonsh.base_shell import BaseShell from xonsh.ansi_colors import ansi_partial_color_format, ansi_color_style_names, ansi_color_style -from xonsh.prompt.base import partial_format_prompt, multiline_prompt +from xonsh.prompt.base import multiline_prompt from xonsh.tools import print_exception from xonsh.platform import ON_WINDOWS, ON_CYGWIN, ON_DARWIN from xonsh.lazyimps import pygments, pyghooks @@ -420,7 +420,7 @@ class ReadlineShell(BaseShell, cmd.Cmd): env = builtins.__xonsh_env__ # pylint: disable=no-member p = env.get('PROMPT') try: - p = partial_format_prompt(p) + p = self.prompt_formatter.format_prompt(p) except Exception: # pylint: disable=broad-except print_exception() hide = True if self._force_hide is None else self._force_hide