emacs shell错误地解释了ipython字符

时间:2016-07-25 13:41:28

标签: linux emacs ipython eshell

我在gnome-terminal内使用emacs -nweshellemacsipython

由于某种原因,emacs shell错误地解释了字符。

这是我看到的(请注意最后3行):

$ ipython
Python 3.5.2 (default, Jun 28 2016, 08:46:01)
Type "copyright", "credits" or "license" for more information.

IPython 5.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

^[[?12l^[[?25hprint("hi")
^[[J^[[?7h^[[?12l^[[?25h^[[?2004lhi

^[[?12l^[[?25h

我认为这必定是一些编码问题,但我不确定如何诊断和修复它。

如果有帮助,请点击此处env输出:

$ env
XDG_VTNR=2
XDG_SESSION_ID=c3
TERM=xterm-256color
SHELL=/bin/bash
XDG_MENU_PREFIX=gnome-
VTE_VERSION=4402
GJS_DEBUG_OUTPUT=stderr
WINDOWID=29360134
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
USER=adrin
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
SESSION_MANAGER=local/mydarlingarch:@/tmp/.ICE-unix/498,unix/mydarlingarch:/tmp/.ICE-unix/498
USERNAME=adrin
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
MAIL=/var/spool/mail/adrin
DESKTOP_SESSION=gnome
QT_QPA_PLATFORMTHEME=qgnomeplatform
XDG_SESSION_TYPE=x11
PWD=/home/adrin
LANG=en_US.UTF-8
GDM_LANG=en_US.UTF-8
GDMSESSION=gnome
XDG_SEAT=seat0
HOME=/home/adrin
SHLVL=1
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
XDG_SESSION_DESKTOP=gnome
LOGNAME=adrin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
WINDOWPATH=2
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0
XDG_CURRENT_DESKTOP=GNOME
COLORTERM=truecolor
XAUTHORITY=/run/user/1000/gdm/Xauthority
_=/usr/bin/env

1 个答案:

答案 0 :(得分:3)

感谢@ brian-malehorn,问题确实是ipython发送的控制字符。

可以通过尝试使用echo -e '\033[0;31mhello\033[1;0m'回显彩色文本来检查,在我的情况下,这会打印彩色文本。如果问题是彩色文本,可以通过以下方式修复:

ipython --colors=NoColor

然而,我的问题不在于上面,因此它必须是ipython发送给shell的控制字符。可以使用以下方法禁用此功能:

ipython --simple-prompt