Repository: xonsh/xonsh

Issue:
Environment section in Wizard looks weird
It looks like the environment section of the wizard is formatted wrong. It looks like it is printing the line feed characters. 

![image](https://cloud.githubusercontent.com/assets/1038978/13364317/723eba02-dcce-11e5-9f2c-89dfd43b31f5.png)

The closest I could get to the problem is that this section is beeing set by the `YesNo` node. This node sets the entire text into the PROMPT variable. .
https://github.com/scopatz/xonsh/blob/f51227e90ad1144ff842e03c235ea5b0dbbb2ee3/xonsh/wizard.py#L529



Discussion:
Thanks for reporting @melund. I think this is an issue with the multiline prompt and having newlines in the prompt...maybe.  The fix is to just have a shorter prompt and make the first a message.  I'll try to fix it tomorrow


Resolving patch:
diff --git a/xonsh/xonfig.py b/xonsh/xonfig.py
--- a/xonsh/xonfig.py
+++ b/xonsh/xonfig.py
@@ -76,13 +76,16 @@
 
 {{BOLD_GREEN}}Note:{{NO_COLOR}} Simply hitting enter for any environment variable
 will accept the default value for that entry.
+""".format(hr=HR)
+
+WIZARD_ENV_QUESTION = "Would you like to set env vars now, " + YN
 
-Would you like to set env vars now, """.format(hr=HR) + YN
 
 WIZARD_TAIL = """
 Thanks for using the xonsh configuration wizard!"""
 
 
+
 def make_fs():
     """Makes the foreign shell part of the wizard."""
     cond = create_truefalse_cond(prompt='Add a foreign shell, ' + YN)
@@ -133,12 +136,13 @@ def _wrap_paragraphs(text, width=70, **kwargs):
     s = '\n'.join(pars)
     return s
 
-ENVVAR_PROMPT = """
+ENVVAR_MESSAGE = """
 {{BOLD_CYAN}}${name}{{NO_COLOR}}
 {docstr}
 {{RED}}default value:{{NO_COLOR}} {default}
-{{RED}}current value:{{NO_COLOR}} {current}
-{{BOLD_GREEN}}>>>{{NO_COLOR}} """
+{{RED}}current value:{{NO_COLOR}} {current}"""
+
+ENVVAR_PROMPT = "{BOLD_GREEN}>>>{NO_COLOR} "
 
 def make_envvar(name):
     """Makes a StoreNonEmpty node for an environment variable."""
@@ -155,20 +159,25 @@ def make_envvar(name):
     curr = pformat(curr, width=69)
     if '\n' in curr:
         curr = '\n' + curr
-    prompt = ENVVAR_PROMPT.format(name=name, default=default, current=curr,
+    msg = ENVVAR_MESSAGE.format(name=name, default=default, current=curr,
                                 docstr=_wrap_paragraphs(vd.docstr, width=69))
+    mnode = Message(message=msg)
     ens = env.get_ensurer(name)
     path = '/env/' + name
-    node = StoreNonEmpty(prompt, converter=ens.convert, show_conversion=True,
-                         path=path)
-    return node
+    pnode = StoreNonEmpty(ENVVAR_PROMPT, converter=ens.convert,
+                          show_conversion=True, path=path)
+    return mnode, pnode
 
 
 def make_env():
     """Makes an environment variable wizard."""
     kids = map(make_envvar, sorted(builtins.__xonsh_env__.docs.keys()))
-    kids = [k for k in kids if k is not None]
-    wiz = Wizard(children=kids)
+    flatkids = []
+    for k in kids:
+        if k is None:
+            continue
+        flatkids.extend(k)
+    wiz = Wizard(children=flatkids)
     return wiz
 
 
@@ -187,7 +196,8 @@ def make_wizard(default_file=None, confirm=False):
             Load(default_file=default_file, check=True),
             Message(message=WIZARD_FS),
             make_fs(),
-            YesNo(question=WIZARD_ENV, yes=make_env(), no=Pass()),
+            Message(message=WIZARD_ENV),
+            YesNo(question=WIZARD_ENV_QUESTION, yes=make_env(), no=Pass()),
             Message(message='\n' + HR + '\n'),
             Save(default_file=default_file, check=True),
             Message(message=WIZARD_TAIL),


Test patch: