mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +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,
|
||||
cwd=cwd,
|
||||
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)
|
||||
except (subprocess.CalledProcessError, FileNotFoundError):
|
||||
return False
|
||||
|
|
|
@ -72,6 +72,7 @@ class PromptToolkitShell(BaseShell):
|
|||
completer=completer,
|
||||
lexer=PygmentsLexer(XonshLexer),
|
||||
multiline=multiline,
|
||||
get_continuation_tokens=self.continuation_tokens,
|
||||
history=history,
|
||||
enable_history_search=enable_history_search,
|
||||
reserve_space_for_menu=0,
|
||||
|
@ -146,6 +147,13 @@ class PromptToolkitShell(BaseShell):
|
|||
toks = partial_color_tokenize(p)
|
||||
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):
|
||||
"""Formats a color string using Pygments. This, therefore, returns
|
||||
a list of (Token, str) tuples.
|
||||
|
|
|
@ -66,6 +66,7 @@ class Prompter(object):
|
|||
if self.cli is None:
|
||||
if self.major_minor <= (0, 57):
|
||||
kwargs.pop('get_rprompt_tokens', None)
|
||||
kwargs.pop('get_continuation_tokens', None)
|
||||
cli = CommandLineInterface(
|
||||
application=create_prompt_application(message, **kwargs),
|
||||
eventloop=eventloop,
|
||||
|
|
Loading…
Add table
Reference in a new issue