Instead of measuring on each stylesheet load at startup,
wait for the initial load of all the stylesheets to complete
and then do the necessary measurments.
It event was not document only being used in EditorComponent. Due to
our batching strategy, it’s fine to respond to individual
::onDidMoveCursor events.
Our new pattern for booleans is to have ::set and ::is, and that means
the property name needs to be in passive voice for ::is to make sense.
This is in preparation for adding a new change observation method.
* ::setSoftWrapped
* ::isSoftWrapped
* ::toggleSoftWrapped
Fixes#3431
When a pane item is moved to another pane, we *detach* the associated
view but we don’t fully remove it. This was to prevent removing a view
when it was used as the pane item directly. However, this was causing
the editor component not to be unmounted, which caused leaks and
incorrect measurements.
We need to unmount the component, but we don’t want to destroy the
editor. So I’ve moved editor destruction to the wrapper view for now,
and I only do it when the view is actually removed.
Ultimately, we need to have a 1:1 relationship with pane items and their
views and only allow a pane item to appear once in the pane tree. Then
we can recycle the same view and avoid this confusing situation where
the old view is detached and a new view is created.
Fixes#3384
This is achieved by calling .preventDefault() on mousedown events when
the editor is already focused, which prevents the moving of focus to
the editor itself.
This pauses updates during measurements. If any updates were requested
while measuring, we force an update synchronously to prevent flicker.
This commit also removes the visibility check before updating, because
we can't force an update from this spot in the lifecycle. This shouldn't
be needed anyway because we are polling for visibility changes.
Ctrl+click on OSX brings up the context menu. In that case, handling the click
event deselects any selection, and that shouldn't happen. See
https://github.com/atom/atom/issues/3308.
* Simplify scrollbar refresh and measurement by using imperative DOM
manipulation instead of React to hide/show scrollbars.
* Rename `::performInitialMeasurement` to `::becameVisible`
* Break `::checkForVisibilityChange` out of `::pollDOM` and use it in
to check for the element becoming visible in `componentWillUpdate`.
* Don't rely on stored visibility state anywhere. Always check again.
This could potentially be cached for an update cycle but being wrong
about this is disastrous so I'm being conservative.
I got the following error when running `checkout-head-revision`:
```
Uncaught TypeError: undefined is not a function /Applications/Atom.app/Contents/Resources/app/src/editor-component.js:804
addCommandListeners.editor:checkout-head-revision /Applications/Atom.app/Contents/Resources/app/src/editor-component.js:804
(anonymous function) /Applications/Atom.app/Contents/Resources/app/src/editor-component.js:840
jQuery.event.dispatch /Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676
elemData.handle /Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360
module.exports.KeymapManager.dispatchCommandEvent /Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:400
module.exports.KeymapManager.handleKeyboardEvent /Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:181
module.exports.WindowEventHandler.onKeydown
```
It looks like it was caused by a bad merge conflict resolution in 0eaec57.
Test Plan:
Built new Atom and pressed `cmd-alt-z` and didn't get an error.
Looked at a side-by-side diff to check for any other merge issues:
```
git difftool -t opendiff 32e59ce..32e59ce^ src/editor-component.coffee
```
This moves observation of the config keys to Editor, which assigns the
invisibles hash or null on the TokenizedBuffer via the DisplayBuffer to
control whether we render invisibles or not.