mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
append newline default
This commit is contained in:
parent
2bbc942e51
commit
34a42fa06c
2 changed files with 9 additions and 3 deletions
|
@ -344,8 +344,8 @@ class BaseShell(object):
|
|||
tee_out = tee.getvalue()
|
||||
self._append_history(inp=src, ts=[ts0, ts1], tee_out=tee_out)
|
||||
self.accumulated_inputs += src
|
||||
append_newline = env.get('XONSH_APPEND_NEWLINE')
|
||||
if append_newline and not tee_out.endswith(os.linesep):
|
||||
if tee_out and env.get('XONSH_APPEND_NEWLINE') \
|
||||
and not tee_out.endswith(os.linesep):
|
||||
print(os.linesep, end='')
|
||||
tee.close()
|
||||
self._fix_cwd()
|
||||
|
|
|
@ -257,6 +257,12 @@ def default_xonshrc(env):
|
|||
return dxrc
|
||||
|
||||
|
||||
@default_value
|
||||
def xonsh_append_newline(env):
|
||||
"""Appends a newline if we are in interactive mode and using prompt-toolkit"""
|
||||
return env.get('XONSH_INTERACTIVE', False) and env.get('SHELL_TYPE') == 'prompt_toolkit'
|
||||
|
||||
|
||||
# Default values should generally be immutable, that way if a user wants
|
||||
# to set them they have to do a copy and write them to the environment.
|
||||
# try to keep this sorted.
|
||||
|
@ -328,7 +334,7 @@ def DEFAULT_VALUES():
|
|||
'share')),
|
||||
'XONSHCONFIG': xonshconfig,
|
||||
'XONSHRC': default_xonshrc,
|
||||
'XONSH_APPEND_NEWLINE': False,
|
||||
'XONSH_APPEND_NEWLINE': xonsh_append_newline,
|
||||
'XONSH_AUTOPAIR': False,
|
||||
'XONSH_CACHE_SCRIPTS': True,
|
||||
'XONSH_CACHE_EVERYTHING': False,
|
||||
|
|
Loading…
Add table
Reference in a new issue