mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
fix: web config tool including \r in prompt (#4969)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
This commit is contained in:
parent
ed11f319fa
commit
1fe284122d
2 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
"""functions to update rc files"""
|
||||
import os
|
||||
import re
|
||||
import typing as tp
|
||||
|
||||
RENDERERS: tp.List[tp.Callable] = []
|
||||
|
@ -39,7 +40,7 @@ def config_to_xonsh(
|
|||
for func in RENDERERS:
|
||||
lines.extend(func(config))
|
||||
lines.append(suffix)
|
||||
return "\n".join(lines)
|
||||
return re.sub(r"\\r", "", "\n".join(lines))
|
||||
|
||||
|
||||
def insert_into_xonshrc(
|
||||
|
|
|
@ -239,7 +239,7 @@ class PromptsPage(Routes):
|
|||
|
||||
def post(self, data: "cgi.FieldStorage"):
|
||||
if data:
|
||||
prompt = data.getvalue(self.var_name)
|
||||
prompt = data.getvalue(self.var_name).replace("\r", "")
|
||||
self.env[self.var_name] = prompt
|
||||
self.update_rc(prompt=prompt)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue