Commit Graph

379 Commits

Author SHA1 Message Date
Ben Ogle
f12b70e3b7 Editor::onDidChangeScreenLines -> onDidChange 2014-09-16 10:51:32 -07:00
Nathan Sobo
ebe116d724 Update parent view is-focused and mini classes on editor mount
Fixes #3526
2014-09-15 16:03:36 -06:00
Nathan Sobo
3faf566a48 Rename editor:toggle-soft-wrapped back to editor:toggle-soft-wrap 2014-09-15 14:34:35 -06:00
Kevin Sawicki
c161e93b96 💄 Add ? 2014-09-11 16:08:04 -07:00
Kevin Sawicki
4a1f048d52 Refresh scrollbars when no stylesheet is specified 2014-09-11 15:44:30 -07:00
Kevin Sawicki
dc5eb95a39 Wait for initial stylesheet load to complete
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.
2014-09-11 15:32:02 -07:00
Ben Ogle
667315aff5 Add ThemeManager::onDidUpdateStylesheet 2014-09-10 18:01:27 -07:00
Ben Ogle
7625e5352d Use event methods in EditorComponent 2014-09-10 17:28:26 -07:00
Ben Ogle
0f83fe54f9 Add and use Editor::observeSelections() and ::observeCursors() 2014-09-09 12:08:43 -07:00
Ben Ogle
6f9f087e11 💄 consistency 2014-09-08 16:05:31 -07:00
Ben Ogle
8aa1784c4a Add Editor::onDidChangeScreenLines 2014-09-08 16:04:43 -07:00
Ben Ogle
aeffef30c6 Directly subscribe to the decorations in EditorComponent 2014-09-05 16:49:30 -07:00
Ben Ogle
7ae25d34e7 Decoration Params -> Properties 2014-09-05 16:20:42 -07:00
Ben Ogle
e6e6028683 Deprecate decoration events 2014-09-05 15:14:27 -07:00
Ben Ogle
6e8a626de2 Add ::onDidChangeSoftWrapped to DisplayBuffer and Editor 2014-09-05 13:41:46 -07:00
Ben Ogle
53fbfb8b27 Merge decoration-changed and decoration-updated
Only emit the decorations from the events
2014-09-05 12:35:52 -07:00
Nathan Sobo
6ad9531e5c Add Selection::onDidChangeRange and ::onDidDestroy and deprecate ::on 2014-09-05 11:39:34 -07:00
Nathan Sobo
56687027b6 Add Cursor::onDidChangePosition and ::onDidDestroy and deprecate ::on 2014-09-05 11:39:34 -07:00
Nathan Sobo
651eb78315 Add Editor::onDidAdd/RemoveSelection
Also update EditorComponent to use the new ::onDidAddSelection method.
2014-09-05 11:39:33 -07:00
Nathan Sobo
3e77b9b7c0 Eliminate Editor::onDidMoveCursor
If you want to know if a cursor moved, subscribe to the cursor.
2014-09-05 11:39:33 -07:00
Nathan Sobo
161edfd15a Remove ‘cursors-moved’ event
It event was not document only being used in EditorComponent. Due to
our batching strategy, it’s fine to respond to individual
::onDidMoveCursor events.
2014-09-05 11:39:33 -07:00
Nathan Sobo
965afc2c37 Rename softWrap to softWrapped
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
2014-09-05 11:39:33 -07:00
Ivan Zuzak
af2f155082 Merge branch 'master' into iz-gutter-click-select-line 2014-09-04 16:22:51 +02:00
Ben Ogle
0703788209 Editor::linesForScreenRows -> ::tokenizedLinesForScreenRows 2014-09-03 14:42:46 -07:00
Nathan Sobo
d3422786c3 Unmount component when EditorView is detached
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.
2014-09-03 11:42:56 -06:00
Ivan Zuzak
ebbfaa23ce Preserve folds when selecting rows by clicking the gutter 2014-09-03 18:54:46 +02:00
Ben Ogle
0b34e46a1a Merge pull request #3420 from atom/bo-update-cursor-selection-apis
Update cursor and selection APIs
2014-09-02 16:41:42 -07:00
Ben Ogle
5ea64f8b11 selectWord() -> selectWordsContainingCursors() 2014-09-02 14:03:57 -07:00
Ben Ogle
70af6198bd selectLine -> selectLinesContainingCursors 2014-09-02 14:02:26 -07:00
Nathan Sobo
c5aa446bc2 Prevent focusout events on hidden input when clicking focused editors
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.
2014-09-02 11:37:46 -06:00
Ivan Zuzak
65cae0f68d Fix indentation to make coffeelint happy 2014-09-01 18:24:04 +02:00
Ivan Zuzak
7f14965ca8 Support selecting multiple rows with meta-click 2014-09-01 17:42:55 +02:00
Ivan Zuzak
8c36d2673b Select row when clicking the gutter 2014-08-30 20:20:09 +02:00
Ben Ogle
9c53d6f014 Deprecate getCursor() 2014-08-28 18:10:18 -07:00
Ben Ogle
2fced0c1bc Deprecate getSelection 2014-08-28 17:51:16 -07:00
Ben Ogle
370ad23f7c Remove Cursor from ::moveCursor* methods 2014-08-28 15:25:12 -07:00
Nathan Sobo
2a94e4a33c Pass tokenizedLines to LinesComponent so measuring stays in sync
Fixes #3318
2014-08-25 18:16:45 -06:00
Nathan Sobo
0849f1ea84 Perform a sync update after editor becomes visible
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.
2014-08-25 17:31:29 -06:00
Ivan Zuzak
b0a9eefa04 Dont handle ctrl+click mouse events on OSX
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.
2014-08-24 13:33:30 +02:00
Nathan Sobo
9164b0ea3b Don't remeasure char widths until we've performed initial measurement 2014-08-22 11:37:04 -06:00
Nathan Sobo
59a80dcd60 Don't use guard clauses in short measurement methods 2014-08-22 11:36:17 -06:00
Nathan Sobo
72354ebf32 Check for visibility change when mounting instead of polling DOM 2014-08-22 11:35:51 -06:00
Nathan Sobo
a71a524ec7 Rework DOM measurement to try to prevent measurement errors
* 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.
2014-08-21 17:50:46 -06:00
Ben Ogle
30aa47026d Do not move cursor when interacting with horiz scrollbar
Fix #3284
2014-08-21 10:40:16 -07:00
Desmond Brand
a1d8ee86f9 Fix error when running checkout-head-revision
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
```
2014-08-17 17:57:08 -07:00
Maximilian Schüßler
32e59ce238 Cleanup code according to coffeelint 2014-08-14 19:41:49 +02:00
Kevin Sawicki
41c62e8628 Add Git::checkoutHeadForEditor
This moves the logic from Editor::checkoutHead
2014-08-13 18:51:19 -07:00
Nathan Sobo
20daed176b Don't show invisibles in mini editors
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.
2014-08-13 16:32:14 -06:00
Nathan Sobo
8c11c4a4c6 Deprecate EditorComponent::setInvisibles with grim 2014-08-13 16:32:13 -06:00
Nathan Sobo
c74f6bb615 Remove handling of invisibles from EditorComponent 2014-08-13 16:31:40 -06:00