ipython/ipython — pull request #3605 by ellisonbg (2013-07-11 00:27:53+00:00)
Title: Fix notebook focus related bugs

The goal of this PR is to fix the various focus related problem in the notebook user experience. The issue for this is #3441. The source of the problem is that we used to call `this.code_mirror.focus` when a cell was selected. This caused all of the jumpy behavior. However, when this call was removed, the entire user experience fell apart. This PR is an attempt to restore a solid user experience while also removing the problematic focus calls.

The result is that the notebook is now a dual mode editor with a command mode and edit mode. Command mode is entered using `ESC` or `Ctrl-m`. Thus our old keyboard shortcuts still work, but multiple of them can be given after you type `Ctrl-m`. Edit mode is entered for the current cell by pressing `Enter`. This is not ready for merge, but we are thinking about trying to merge this for 1.0. But, it will need lots of testing. The code is relatively simple, but the new interaction model is quite subtle and there are numerous tweaks we could make.

Another side effect is that multiple markdown, rawtext and heading cells can now be unrendered at the same time.

Overall I think this is a massive improvement of the user experience. **But, this needs tons of interactive hands on user experience testing**.

Remaining issues:

- [ ] Test various notebook and cell actions (cut, copy, paste, merge, split, etc.).
- [ ] Keyboard shortcuts for command mode need to be turned off when the notebook area is not in focus. This is currently preventing dialogs and other things that require keyboard input from working.
- [ ] Test and debug tooltips.
- [ ] Test to make sure that the pager can be closed with `ESC`.
- [ ] Test and debug tab completion.
- [ ] Possibly refactor the keyboard shortcut code to make it all configurable.

Questions:

* Do we like how `Shift-Enter`, `Ctrl-Enter` and `Alt-Enter` behave?
* Should we always enter edit mode when a cell is changed type?
* Do people like the green border to indicate edit mode?