Message208890
If you change the sys.ps1 to have some color, you end up messing up readline's input line calculations and the characters in the line you are typing might not get displayed properly. This behaviour is easier to demonstrate/reporduce than explain ...:
On a python promt with readline enabled (for instance, on any linux box):
[steve@localhost ~]$ python
Python 2.7.5 (default, Nov 12 2013, 16:18:42)
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.ps1 = '\033[31m>>> \033[0m'
>>> # doing a reverse-i-search (Ctrl+r) on the next line will mess up the prompt display
...
>>> h)`sys': sys.ps1 = '\033[31m>>> \033[0m'
(...press Ctrl-L to clear...)
(reverse-i-search)`': (press enter)
>>> arch)`':
I did some (amateur) investigation and the root cause might be similar to what's reported at:
http://trac.haskell.org/haskeline/ticket/78
https://groups.google.com/forum/#!topic/gnu.bash.bug/5P0gWzzLVOU
FWIW, I bumped into this issue while customizing my .pythonrc[1] and although it might be a silly small annoyance, it would be really nice if this bug could be fixed.
[1] https://gist.github.com/lonetwin/5902720 |
|
Date |
User |
Action |
Args |
2014-01-23 09:09:10 | lonetwin | set | recipients:
+ lonetwin |
2014-01-23 09:09:10 | lonetwin | set | messageid: <1390468150.14.0.430221265473.issue20359@psf.upfronthosting.co.za> |
2014-01-23 09:09:10 | lonetwin | link | issue20359 messages |
2014-01-23 09:09:08 | lonetwin | create | |
|