xonsh / xonsh

:shell: Python-powered shell. Full-featured and cross-platform.
http://xon.sh
Other
8.4k stars 638 forks source link

Characters on the same line as the prompt disappear #2093

Closed Siecje closed 6 years ago

Siecje commented 7 years ago

If the prompt doesn't start at the beginning of a line the characters before the prompt will disappear when you press enter.

For example

$ cd ~/.config/xonsh
$ ~/./xonsh $ cat config.json 
{
 "xontribs": [
  "prompt_ret_code"
 ]
}~/./xonsh $ 

If I press enter (with a command or without)

}~/./xonsh $ line becomes ~/./xonsh $

~/./xonsh $ cat config.json 
{
 "xontribs": [
  "prompt_ret_code"
 ]
~/./xonsh $ 
~/./xonsh $ 

xonfig

+------------------+---------------------------------------------------+
| xonsh            | 0.5.2                                             |
| Git SHA          | f1f19f7                                           |
| Commit Date      | Jan 4 17:47:31 2017                               |
| Python           | 3.5.2                                             |
| PLY              | 3.9                                               |
| have readline    | True                                              |
| prompt toolkit   | 1.0.9                                             |
| shell type       | prompt_toolkit                                    |
| pygments         | 2.1.3                                             |
| on posix         | True                                              |
| on linux         | <xonsh.lazyasd.LazyBool object at 0x7f272b610128> |
| distro           | ubuntu                                            |
| on darwin        | False                                             |
| on windows       | False                                             |
| on cygwin        | False                                             |
| is superuser     | False                                             |
| default encoding | utf-8                                             |
| xonsh encoding   | utf-8                                             |
| encoding errors  | surrogateescape                                   |
+------------------+---------------------------------------------------+
gforsyth commented 7 years ago

Thanks for reporting @Siecje ! This looks like it only affects the prompt_toolkit backend -- the prompt is being drawn in the wrong place due to the lack of a trailing newline and then it's being redrawn for some reason after hitting Enter.

scopatz commented 7 years ago

I agree with @gforsyth. This seems to be a PTK only thing. Have you opened an issue with them?

scopatz commented 7 years ago

Since this seems like it is a WONT-FIX from prompt-toolkit, I feel that this is now a feature request similar to #448. Pull requests still welcome!

gforsyth commented 6 years ago

I'm going to close this as a WONT-FIX due to the upstream WONT-FIX. Note, however, that a workaround / solution was put in in #2412

With the prompt_toolkit backend you can set $XONSH_APPEND_NEWLINE=True to force the insertion of a newline if there is not one present and avoid the overdrawing of the prompt.

scopatz commented 6 years ago

better default behaviour proposed over at #2605