New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dual mode bug fixes. #5146
Dual mode bug fixes. #5146
Conversation
Glad you're figuring out the FF and Chrome differences, I've been struggling with those in ipython-vimception. |
I'm trying really hard... The current thing I'm stuck on is "focusout" events not being fired for bootstrap text boxes on FF. Argh! I'm surprised no one has reported this in master. It seems as is focusing on a textbox completely disables the keyboard manager until page refresh... |
This is ready for some testing by others & code review. I've left |
Thanks for pointing this out @juhasch - I made a couple more changes that should fix the problem, tell me if they fix the problem for you too. I also retested the other issues this PR addresses, they are all still fixed. |
Yep, this is fixed for me, too. Unfortunately, the old trick
|
Unfortunately I can't replicate that problem with either of my browsers (FF 25 & Chrome 31) 😞 . Following the steps you provided, my notebook ends up in a state with only cell one selected, in edit mode. This behavior is consistent for me, two questions:
|
Scratch that! I was just able to replicate it, VERY weird though... Had to click on the blank space not the text of the prompt. |
@juhasch I found and removed a race condition which was making that incorrect behavior exist approx. 1/2 times on my machine. Can you verify that it fixes it for you too? |
Looks good here. Thanks for digging so deep into this! |
Woohoo! That's great news. |
I will try to have a look at this soon. On Wed, Feb 19, 2014 at 1:36 PM, Jonathan Frederic <notifications@github.com
Brian E. Granger |
@@ -147,23 +147,28 @@ var IPython = (function (IPython) { | |||
} | |||
if (this.code_mirror) { | |||
this.code_mirror.on('focus', function(cm, change) { | |||
$([IPython.events]).trigger('edit_mode.Cell', {cell: that}); | |||
console.log('cell focused'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a ton of console.log
calls that should be removed before we merge this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ellisonbg definitely, there is a disclaimer in one of the comments above "When it is decided this PR is ready for merge, I'll remove them all." 😃
This jsfiddle helped me to understand the different events: |
}); | ||
|
||
// There are times (raw_input) where we remove the element from the DOM before | ||
// focusout is called. In this case we bind to the remove event of jQueryUI, | ||
// which gets triggered upon removal, iff it is focused at the time. | ||
e.on('remove', function () { | ||
if (document.activeElement === e[0]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to replace this test by a call to is_focused
to cover the case where the element removed is not focused, but a child is.
OK, this PR has reintroduced an old bug:
This is a sight variant of the original bug, which would not even show the cursor at the new position. |
I see the following:
|
I can't manage to reproduce that on either Chrome or FF with cleared caches, but that doesn't mean I don't believe that there may still be a problem. There is still the timeout for the tooltip and tab completer, I'd like to try to rid this code of that too if possible since it seems to be a source of inconsistent failures. I think I have an idea of how I could do it reliably... |
I've fixed the problems pointed out. I had to make a lot of changes to get everything to work. Fixing one thing meant removing a fix for another. In the end I removed all of the |
if (!cell) {return;} | ||
|
||
// Only respect the blur event if the tooltip and autocompleter are | ||
// not visible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this more generic? there are ways of using dialogs in codemirror that will also trigger blur events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could possibly add a way to register exceptions like this on the notebook and cell level. I'll look into that now.
Half overhaul of notebook focus events...
Removed logic for reverse ordered events Removed almost all of the log statements Removed list for should unfocus callbacks Removed all the logic in focus_editor Only call focus_editor if the keyboard was used to enter edit mode
Implemented whiteboard logic
@jdfreder and I consider this ready for merge. This should be a massive improvement in stability and we have refactored much of the internals to prevent these problems in the future. This should be merged ASAP to get lots of testing before release. |
* @param [index] {int} Cell index to select. If no index is provided, | ||
* the current selected cell is used. | ||
**/ | ||
Notebook.prototype.trigger_edit_mode = function (index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably edit_mode
and command_mode
should be symmetrical. I don't see why trigger_
was added, but if it should be, it should be added to both.
Dual mode bug fixes.
closes #5149, #4999, #5094