Skip to content
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

Merged
merged 25 commits into from Feb 28, 2014
Merged

Dual mode bug fixes. #5146

merged 25 commits into from Feb 28, 2014

Conversation

jdfreder
Copy link
Member

closes #5149, #4999, #5094

@ivanov
Copy link
Member

ivanov commented Feb 18, 2014

Glad you're figuring out the FF and Chrome differences, I've been struggling with those in ipython-vimception.

@jdfreder
Copy link
Member Author

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...

@jdfreder
Copy link
Member Author

This is ready for some testing by others & code review. I've left console.log statements everywhere just in case there are more bugs I need to track. When it is decided this PR is ready for merge, I'll remove them all.

@juhasch
Copy link
Contributor

juhasch commented Feb 19, 2014

This is better, I could not reproduce the jumping cells behavior.
Still, when hitting shift+return in a new notebook:
shift-return

@jdfreder
Copy link
Member Author

This is better, I could not reproduce the jumping cells behavior.
Still, when hitting shift+return in a new notebook:

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.

@juhasch
Copy link
Contributor

juhasch commented Feb 19, 2014

Yep, this is fixed for me, too. Unfortunately, the old trick

  • cell 1 in edit mode
  • click outside of the browser
  • click on the In area of cell 2
    still gives me the same effect as in my previous comment.

@jdfreder
Copy link
Member Author

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:

  • Did you make sure the cache was cleared?
  • Is it an intermittent failure or constant?

@jdfreder
Copy link
Member Author

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.

@jdfreder
Copy link
Member Author

@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?

@juhasch
Copy link
Contributor

juhasch commented Feb 19, 2014

Looks good here. Thanks for digging so deep into this!

@jdfreder
Copy link
Member Author

Looks good here. Thanks for digging so deep into this!

Woohoo! That's great news.

@ellisonbg
Copy link
Member

I will try to have a look at this soon.

On Wed, Feb 19, 2014 at 1:36 PM, Jonathan Frederic <notifications@github.com

wrote:

Looks good here. Thanks for digging so deep into this!

Woohoo! That's great news.

Reply to this email directly or view it on GitHubhttps://github.com//pull/5146#issuecomment-35551916
.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@@ -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');
Copy link
Member

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.

Copy link
Member Author

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." 😃

@ellisonbg
Copy link
Member

This jsfiddle helped me to understand the different events:

http://jsfiddle.net/GK7sN/2/

});

// 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]) {
Copy link
Member

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.

@ellisonbg
Copy link
Member

OK, this PR has reintroduced an old bug:

  1. Create a large code cell with a couple of pages worth of source.
  2. Enter edit mode and put the CM cursor in the first line or so.
  3. Scroll that line of code off the screen.
  4. Click outside the cell to enter command mode.
  5. Click inside the cell on the last line or so. The screen will jump-scroll to the previous cursor position.
  6. But the cursor will be at the new place you clicked.

This is a sight variant of the original bug, which would not even show the cursor at the new position.

@ellisonbg
Copy link
Member

I see the following:

  • Enter edit mode in a cell.
  • Click outside the browser widow (somewhere on the desktop).
  • Back into the notebook.
  • Now you can't use the mouse to enter command mode by clicking outside a cell.
  • The overall state remains somehow broken

@jdfreder
Copy link
Member Author

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...

@jdfreder
Copy link
Member Author

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 setTimeout calls involved with this code and used alternative fixes. @ellisonbg and @juhasch if you guys could test the changes that would be great!

if (!cell) {return;}

// Only respect the blur event if the tooltip and autocompleter are
// not visible.
Copy link
Member

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

Copy link
Member Author

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.

@ellisonbg
Copy link
Member

@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) {
Copy link
Member

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.

ellisonbg added a commit that referenced this pull request Feb 28, 2014
@ellisonbg ellisonbg merged commit edfc0fa into ipython:master Feb 28, 2014
@jdfreder jdfreder deleted the modal-fix branch March 10, 2014 18:43
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking on a TextBoxWidget in FF completely breaks dual mode.
5 participants