mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 00:41:00 +01:00
Merge branch 'master' into c
This commit is contained in:
commit
0a3a1868aa
3 changed files with 15 additions and 0 deletions
|
@ -870,6 +870,12 @@ def git_dirty_working_directory(cwd=None):
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
|
if len(s) == 0:
|
||||||
|
# Workaround for a bug in ConEMU/cmder
|
||||||
|
# retry without redirection
|
||||||
|
s = subprocess.check_output(cmd,
|
||||||
|
cwd=cwd,
|
||||||
|
universal_newlines=True)
|
||||||
return bool(s)
|
return bool(s)
|
||||||
except (subprocess.CalledProcessError, FileNotFoundError):
|
except (subprocess.CalledProcessError, FileNotFoundError):
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -72,6 +72,7 @@ class PromptToolkitShell(BaseShell):
|
||||||
completer=completer,
|
completer=completer,
|
||||||
lexer=PygmentsLexer(XonshLexer),
|
lexer=PygmentsLexer(XonshLexer),
|
||||||
multiline=multiline,
|
multiline=multiline,
|
||||||
|
get_continuation_tokens=self.continuation_tokens,
|
||||||
history=history,
|
history=history,
|
||||||
enable_history_search=enable_history_search,
|
enable_history_search=enable_history_search,
|
||||||
reserve_space_for_menu=0,
|
reserve_space_for_menu=0,
|
||||||
|
@ -146,6 +147,13 @@ class PromptToolkitShell(BaseShell):
|
||||||
toks = partial_color_tokenize(p)
|
toks = partial_color_tokenize(p)
|
||||||
return toks
|
return toks
|
||||||
|
|
||||||
|
def continuation_tokens(self, cli, width):
|
||||||
|
"""Displays dots in multiline prompt"""
|
||||||
|
dots = builtins.__xonsh_env__.get('MULTILINE_PROMPT')
|
||||||
|
_width = width - 1
|
||||||
|
dots = _width // len(dots) * dots + dots[:_width % len(dots)]
|
||||||
|
return [(Token, dots + ' ')]
|
||||||
|
|
||||||
def format_color(self, string, **kwargs):
|
def format_color(self, string, **kwargs):
|
||||||
"""Formats a color string using Pygments. This, therefore, returns
|
"""Formats a color string using Pygments. This, therefore, returns
|
||||||
a list of (Token, str) tuples.
|
a list of (Token, str) tuples.
|
||||||
|
|
|
@ -66,6 +66,7 @@ class Prompter(object):
|
||||||
if self.cli is None:
|
if self.cli is None:
|
||||||
if self.major_minor <= (0, 57):
|
if self.major_minor <= (0, 57):
|
||||||
kwargs.pop('get_rprompt_tokens', None)
|
kwargs.pop('get_rprompt_tokens', None)
|
||||||
|
kwargs.pop('get_continuation_tokens', None)
|
||||||
cli = CommandLineInterface(
|
cli = CommandLineInterface(
|
||||||
application=create_prompt_application(message, **kwargs),
|
application=create_prompt_application(message, **kwargs),
|
||||||
eventloop=eventloop,
|
eventloop=eventloop,
|
||||||
|
|
Loading…
Add table
Reference in a new issue