Repository: xonsh/xonsh

Issue:
Web config tool includes \r in prompt
When using the web config (xonfig web), newlines are interpreted as "\r\n". On macOS (and Linux, I assume) this adds a "^M" to the prompt, before the newline. 
## xonfig
```
+------------------+--------------------------------+
| xonsh            | 0.13.3                         |
| Python           | 3.10.7                         |
| PLY              | 3.11                           |
| have readline    | True                           |
| prompt toolkit   | 3.0.31                         |
| shell type       | prompt_toolkit                 |
| history backend  | json                           |
| pygments         | 2.13.0                         |
| on posix         | True                           |
| on linux         | False                          |
| on darwin        | True                           |
| on windows       | False                          |
| on cygwin        | False                          |
| on msys2         | False                          |
| is superuser     | False                          |
| default encoding | utf-8                          |
| xonsh encoding   | utf-8                          |
| encoding errors  | surrogateescape                |
| xontrib          | []                             |
+------------------+--------------------------------+
```

## Expected Behavior
I would expect the "\r" to be stripped from the text field before the prompt is set. 

## Current Behavior
I was able to confirm that the "\r" is being added to the prompt variable by checking my .xonshrc after using the web config. Removing this value removes the "^M" from my prompt.

## Steps to Reproduce
* Run xonfig web from your shell.
* Select a multi-line prompt, and set your .xonshrc
* Exit and restart xonsh. You'll see a "^M" before the new line.

## For community
⬇️  **Please click the 👍 reaction instead of leaving a `+1` or 👍  comment**



Discussion:
i'm happy to try working on this, could someone assign me the issue?
All yours, @peipacut -- we historically haven't relied on issue assignment, you should feel free to pick up any open issues and just ping in the issue that you're going to work on them to avoid duplicate effort.

Resolving patch:
diff --git a/xonsh/webconfig/file_writes.py b/xonsh/webconfig/file_writes.py
--- a/xonsh/webconfig/file_writes.py
+++ b/xonsh/webconfig/file_writes.py
@@ -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(
diff --git a/xonsh/webconfig/routes.py b/xonsh/webconfig/routes.py
--- a/xonsh/webconfig/routes.py
+++ b/xonsh/webconfig/routes.py
@@ -239,7 +239,7 @@ def get(self):
 
     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)
 


Test patch: