[IPython-dev] available modifier keys. Broken Shift-Ins paste.

Dmitry Chichkov dchichkov at gmail.com
Mon Jul 16 14:53:55 EDT 2012


I really apologize for the confusion.

As per MinRK, the actual fix is updating CodeMirror and have nothing to do
with the commit.
My mistake. I also had an updated version of CodeMirror. And I'd guess
browser cache was messing my tests.

Dmitry


Just in case, here are the steps to fix the issue:
==== Under root:  ====
cd ipython-0.13-py2.7.egg/IPython/frontend/html/notebook/static
mv codemirror  codemirror.orig
wget http://codemirror.net/codemirror.zip
unzip codemirror.zip
mv CodeMirror-2.3 codemirror

Update codemirror/mode/python/python.js  as per
codemirror.orig/README-IPython.rst.
 (it is a one-line change, add `\\?` to the end of singleOperators
definition at line 8 chr 62)
==================


On Sat, Jul 14, 2012 at 4:02 PM, MinRK <benjaminrk at gmail.com> wrote:

> On Sat, Jul 14, 2012 at 3:20 PM, Dmitry Chichkov <dchichkov at gmail.com>
> wrote:
> > Yes, actually, one that works for me is 'return false':
> >
> >
> > else if (event.which === key.SHIFT) {
> >    // ignore shift keydown
> >    return false;
> > }
> >
> > I was trying out 'commenting out' version after I've found that return
> false
> > worked. And working version was still in the  browser cache. Regarding
> > "ctrl+m-shift+<key>" - I don't use it. So, I don't know, if returning
> false
> > breaks it or not.
>
> Okay, thanks.  `return false` is fine for the existing case, the only
> important thing is that it returns without resetting the control_key
> state, so it sounds like that is the right fix.
>
> -MinRK
>
> >
> > Dmitry
> >
> >
> > On Sat, Jul 14, 2012 at 11:52 AM, MinRK <benjaminrk at gmail.com> wrote:
> >>
> >> I commented this out, and shift-ins paste still doesn't work for me.
> >> I also don't see how this would be any different, as the same event
> >> will just skip all the following handlers, and return True at the end
> >> of the function (after restoring control_key_active=false, which is
> >> the behavior this is meant to avoid).
> >>
> >> Of course, commenting it out is obviously the wrong answer, as that
> >> necessarily re-breaks the thing that commit fixed
> >> (ctrl+m-shift+<key>).  What should the real event be?  Should it
> >> return False?
> >>
> >> On Sat, Jul 14, 2012 at 7:03 AM, klo uo <klonuo at gmail.com> wrote:
> >> > Great Dmirty, I already reported the issue also on github
> >> > https://github.com/ipython/ipython/issues/2113 but someone tagged it
> >> > as feature request instead bug
> >> >
> >> > Are you saying that by commenting that line everything works as
> >> > expected and it does not affect Notebook in any way?
> >> >
> >> >
> >> > On Fri, Jul 13, 2012 at 9:51 PM, Dmitry Chichkov <dchichkov at gmail.com
> >
> >> > wrote:
> >> >> It looks like broken "Shift-Ins" paste in Notebook is have something
> to
> >> >> do
> >> >> with the following code in the
> >> >> IPython/frontend/html/notebook/static/js/notebook.js :
> >> >>
> >> >> else if (event.which === key.SHIFT) {
> >> >>    // ignore shift keydown
> >> >>    return true;
> >> >> }
> >> >>
> >> >> If I'm commenting it out, shift-insert paste starts working again.
> >> >>
> >> >> It looks like this code was introduced in the following commit
> 8dc3ac7
> >> >> -
> >> >> "prevented case-sensitive shortcuts if shift was pressed after
> control
> >> >> key:
> >> >>
> >> >>
> https://github.com/ipython/ipython/commit/8dc3ac7c3961a5486aeb8552d772e7be45c6128f
> >> >>
> >> >>
> >> >> Dmitry
> >> >>
> >> >>
> >> >>> Don't know what OS you run, but FYI Alt-Enter doesn't seem to do
> >> >>> anything on Windows in both Firefox and Chrome.
> >> >>> >From the user point of view, your suggestion for executing and
> >> >>> appending new cell in one shortcut, looks interesting to me
> >> >>>
> >> >>> While here, I don't want to steal your topic, but as I opened it
> >> >>> because you mentioned modifiers, I noticed strange behavior and I'm
> >> >>> not sure if it's the way it should be: CUI clipboard commands, which
> >> >>> are handy in Notebook environment, behave like this on my PC:
> >> >>>
> >> >>>  - Ctrl-Ins (Copy) - copies selection to clipboard (as expected)
> >> >>>  - Shift-Del (Cut) - deletes selection (can be easily mistaken that
> >> >>> contents is cut to clipboard)
> >> >>>  - Shift-Ins (Paste) - doesn't paste but triggers Insert
> >> >>>
> >> >>> so it looks like some changes to Shift modifier has something to do
> >> >>> with this unfortunate behavior.
> >> >>>
> >> >>>
> >> >>> On Mon, Jul 2, 2012 at 7:30 PM, Zoltán Vörös <zvoros at gmail.com>
> wrote:
> >> >>> > Hi All,
> >> >>> >
> >> >>> > I know that since the notebook is supported on many platforms and
> on
> >> >>> > many browsers, the intersection of the many sets containing
> >> >>> > modifiers is
> >> >>> > somewhat limited, so I would like to ask, whether something like
> >> >>> > Alt+Enter would work on all systems. What I would like to suggest
> (I
> >> >>> > can
> >> >>> > also implement it, if I am given the go-ahead) is a shortcut for
> >> >>> > Shift+Enter + Control-m a. Many a time, I find myself going back
> to
> >> >>> > a
> >> >>> > piece of code in the middle of the notebook, and after entering a
> >> >>> > statement, I would like to get a new code cell at that particular
> >> >>> > place.
> >> >>> > Control+Enter takes me back to the cell, and Shift+Enter jumps to
> >> >>> > the
> >> >>> > next cell. I think, such an addition would be useful, but I don't
> >> >>> > know
> >> >>> > what the allowed modifiers are.
> >> >>> >
> >> >>> > Any comments or suggestions?
> >> >>> >
> >> >>> > Cheers,
> >> >>> > Zoltán
> >> >>> > _______________________________________________
> >> >>> > IPython-dev mailing list
> >> >>> > IPython-dev at scipy.org
> >> >>> > http://mail.scipy.org/mailman/listinfo/ipython-dev
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> IPython-dev mailing list
> >> >> IPython-dev at scipy.org
> >> >> http://mail.scipy.org/mailman/listinfo/ipython-dev
> >> >>
> >> > _______________________________________________
> >> > IPython-dev mailing list
> >> > IPython-dev at scipy.org
> >> > http://mail.scipy.org/mailman/listinfo/ipython-dev
> >> _______________________________________________
> >> IPython-dev mailing list
> >> IPython-dev at scipy.org
> >> http://mail.scipy.org/mailman/listinfo/ipython-dev
> >
> >
> >
> > _______________________________________________
> > IPython-dev mailing list
> > IPython-dev at scipy.org
> > http://mail.scipy.org/mailman/listinfo/ipython-dev
> >
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120716/bb3b266c/attachment.html>


More information about the IPython-dev mailing list