3

Running a file consisting of the line

import ipdb;ipdb.set_trace()

then entering more than 19 or more arbitrary characters in the command line and then hitting Home button (or Ctrl-A) makes the cursor go to position 11 instead of position 0 of the line and the line is garbaged as a result (it doesn't let me to the left of the 11th position in the line):

$ python ~test/c.py 
--Return--
None
> /home/test/c.py(2)<module>()
      1 import ipdb
----> 2 ipdb.set_trace()

ipdb> 1234567890123456789

Now pressing <Home> and then '_':

ipdb> 12345678901_1234567890123456789

while I expected it to be

ipdb> _1234567890123456789

Fresh install of Ubuntu and fresh install of Archlinux, python 2.7.10, 3.4.3+ are both affected. No libs except for ipdb 0.7, 0.8 or 0.9 (+dependencies) are installed.

Everything is ok in ipython or python command lines.

Tested in terminal, terminator and text terminal (ctrl-alt-f1), using bash and zsh.

Any idea why?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Antony Hatchkins
  • 31,947
  • 10
  • 111
  • 111
  • I'm trying to replicate your problem. I started by simply executing pdbtrace and my output by default has the character offset. http://pastebin.com/ZmWFH9Ur . Maybe I misunderstood something on how to replicate? – idjaw Feb 27 '16 at 14:45
  • @idjaw I've added what I expected it to look like, gave more detailed description of what I've run into – Antony Hatchkins Feb 27 '16 at 14:50
  • 1
    Wow. That *is* weird....Replicated. (FYI I'm using iTerm2 and zsh) – idjaw Feb 27 '16 at 14:54
  • @idjaw google is unaware of this issue, I tried lots of different wordings – Antony Hatchkins Feb 27 '16 at 14:55
  • I'm currently going through the [source](https://hg.python.org/cpython/file/2.7/Lib/pdb.py). It is overriding the shell (obviously) and not understanding several key-bindings. Like ctrl-a usually takes you the beginning of the line. pdb prompt does not understand that. I see from the source there is a dot file that it looks for. Maybe there are bindings or a way to source something to not kill key mappings. – idjaw Feb 27 '16 at 15:07
  • @idjaw pdb seems to be working fine for me. Only ipdb has this behaviour. And ipdb is a lightweight wrapper over ipython, which makes it a very awkward bug for me. – Antony Hatchkins Feb 27 '16 at 15:15
  • @idjaw ctrl-r seems to be somehow connected to this because it (ctrl-r, then esc) allows me to go to character 0, but the line is still garbaged – Antony Hatchkins Feb 27 '16 at 15:16
  • Oh! Wrong source. Thanks for pointing that out. BTW, I am not experiencing issues when doing this from within PyCharm – idjaw Feb 27 '16 at 15:17
  • @idjaw putty+debian doesn't have this issue either – Antony Hatchkins Feb 27 '16 at 15:23
  • @idjaw I've ruined my ubuntu through uninstalling python :) Thinking of switching to debian... Temporarily nothing to debug on my side. Will continue after debian is up and running :) – Antony Hatchkins Feb 27 '16 at 16:41
  • Too much science for a Saturday. Get a beer. :P – idjaw Feb 27 '16 at 16:42
  • 1
    @idjaw indeed so :))))) – Antony Hatchkins Feb 27 '16 at 17:22

1 Answers1

2

Downgrading ipython to 4.0.0 solves the same problem for me. Credit discussion at https://github.com/gotcha/ipdb/issues/87 (circular reference here)

LmW.
  • 1,364
  • 9
  • 16