[IPython-dev] possible cpaste bug

Fernando Perez fperez.net at gmail.com
Wed Aug 12 01:06:55 EDT 2009


On Tue, Aug 11, 2009 at 5:24 PM, John Hunter<jdh2358 at gmail.com> wrote:

> I tried to try on xterm, but goddam osx and xterms do not play nicely
> together.  I could not paste from the desktop environment to the x11
> environment since my buffer was not recognized, so I tried to cat the
> example in one xterm to paste it into another but could not get the
> whole thing on one screen and could not get the window to scroll as I
> moved the mouse past the top.  I'm sure there is a way to do this
> (Robert 3..2..1..) but I don't know how so I punted.  I am pretty sure
> Robert's explanation is correct, though it is a major wart to simply
> drop the input to the term, which appears to be what os x is doing,
> IMO.

Yes, majorly annoying indeed (and it's awful that the two major linux
desktop terminal emulators both also have the bug, when 20+ years old
xterm gets it right).

> "paste" did work, so that is cool (thanks Robert!)  But for
> tutorial/demo purposes, which is what is on my mind of late, the
> screen echo is nice, kind of a "nothing up my sleaves" feeling, that
> the paste with no echo does not have.  Could we do a paste -e (echo)
> or -v (verbose) and ask paste to echo the paste to the stdout, even if
> only for visual effect (and during the tutorial its nice to point to
> the code in the terminal)

Your wish is our command, Dr. Hunter; bug and solution:

https://bugs.launchpad.net/ipython/+bug/412339
https://code.launchpad.net/~ipython-dev/ipython/cpaste-fixes

In action:

In [2]: paste -e
x = 1
y = 2
print 'x, y:',x,y
## -- End pasted text --
x, y: 1 2

In [3]: paste
x, y: 1 2

In [4]: paste -r
Re-executing 'x = 1...' (30 chars)
x, y: 1 2


1-800-pygeeks at your service!

Cheers,

f

ps - you can safely merge from that branch into your working one.
Since Brian is in the middle of major reorganizations, this may take a
few days to get merged, as I don't want to get in his way.  But it's
localized enough that you can merge it for next week's tutorials
locally while we get it in place.



More information about the IPython-dev mailing list