Comparar commits

...

304 Commits

Autor SHA1 Mensagem Data
Nathan Sobo f06c3402c3 WIP: Transfer foreground/background color into shadow DOM
Refs #4086
2014-11-11 16:59:36 -07:00
Nathan Sobo e3d70ebad0 💄 2014-11-11 16:58:38 -07:00
Nathan Sobo e238292075 Remove WorkspaceElement::handleWindowFocus
We were getting stack traces in specs when the window got focused caused
by this subscription never getting disposed. We investigated, and can’t
find a case where removing this causes any issues.

Tested:
* Loading/reloading empty window
* Loading/reloading window with pane splits
* Opening/closing dev tools
* Switching focus between atom windows
* Switching focus between applications

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 16:24:02 -07:00
Nathan Sobo 9fd52f600e Dispose of WorkspaceElement subscriptions when detached
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 16:24:02 -07:00
Nathan Sobo c75e692269 Don’t add undefined context menus when activating package resources
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 16:24:02 -07:00
Nathan Sobo 6770570f13 Don't call Grim.deprecate for undefined context menus
This preserves the original behavior, in which passing undefined to
atom.contextMenu.add was a no-op that returned a no-op disposable.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 16:24:02 -07:00
Nathan Sobo 9875b069bc Merge pull request #4152 from atom/ns-highlight-region-classes
Add private API for adding classes to highlight regions for backward compatibility
2014-11-11 15:20:47 -07:00
Ben Ogle 58892be6f7 Use proper verbiage for the docs 2014-11-11 11:24:46 -08:00
Ben Ogle 2aaa025d72 Add deprecated getMoveNextWordBoundaryBufferPosition
Closes #4151
2014-11-11 11:24:10 -08:00
Max Brunsfeld 1474aa2116 Merge pull request #4148 from atom/mb-cut-line
Cut whole lines when no text is selected
2014-11-11 11:13:51 -08:00
Nathan Sobo 2de8046f99 Add deprecatedRegionClass option to highlight decorations
This adds a class to each of the contained regions so we can make
existing bundled packages backward-compatible with themes.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 12:11:26 -07:00
Nathan Sobo a58af721f1 Assign highlight decoration React keys based on decoration id instead of class
@benogle: I think this should be fine now that we assign id’s, right?

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 12:11:26 -07:00
Kevin Sawicki 3a0bce0618 ⬆️ settings-view@0.159 2014-11-11 10:57:54 -08:00
Kevin Sawicki 658dc8e9c3 Merge pull request #4141 from atom/ks-file-encoding-config
Default buffer encoding to core.fileEncoding config
2014-11-11 10:07:53 -08:00
Max Brunsfeld 7a87c22c7d Cut/copy whole lines when no text is selected
Closes #3643
2014-11-11 10:02:17 -08:00
Kevin Sawicki e36eaa56cb Add windows1252 2014-11-11 09:47:34 -08:00
Kevin Sawicki 84a74d68cf Remove windows1250 duplicate 2014-11-11 09:47:34 -08:00
Kevin Sawicki 5946590a66 Add spec for default file encoding 2014-11-11 09:47:34 -08:00
Kevin Sawicki 268a3649b6 Use core.fileEncoding as default buffer encoding 2014-11-11 09:47:34 -08:00
Kevin Sawicki 3e67766d1a Add core.fileEncoding config schema 2014-11-11 09:47:34 -08:00
Kevin Sawicki 1038684014 Prepare 0.146 2014-11-11 09:47:07 -08:00
Kevin Sawicki 43acb99f86 ⬆️ encoding-selector@0.7 2014-11-11 09:02:19 -08:00
Nathan Sobo 8dccc8e07c Merge pull request #4143 from atom/ns-fix-scrollbar-regression
Always re-render scrollbars after themes load/reload
2014-11-10 19:50:13 -07:00
Max Brunsfeld 3c800b00f5 Always re-render scrollbars after themes load/reload
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-10 17:59:41 -08:00
Kevin Sawicki cb0f531b9a ⬆️ find-and-replace@0.146 2014-11-10 16:55:50 -08:00
Kevin Sawicki 5e61c7b38a ⬆️ symbols-view@0.68 2014-11-10 15:53:19 -08:00
Nathan Sobo 57f85e1720 Add regression coverage for “hidden pane item after dragging” bug #4112
Refs bad0504e1d
2014-11-10 15:55:21 -07:00
Kevin Sawicki f4ced3b078 Autoscroll when selecting the entire line
Closes #4032
2014-11-10 14:51:03 -08:00
Ben Ogle 9553c46030 Override the default styling of .highlight in the editor.
Closes #4136
2014-11-10 14:34:50 -08:00
Kevin Sawicki 14e73e0c63 pane -> Pane 2014-11-10 14:31:21 -08:00
Ben Ogle 5c5c6e77fd Move method to be with similar methods in the docs. 2014-11-10 14:18:35 -08:00
Ben Ogle e9678a15f1 Add more docs for getPrev/NextWordBoundary methods 2014-11-10 14:18:15 -08:00
Ben Ogle f0135adb62 Fix method name 2014-11-10 14:17:48 -08:00
Ben Ogle 58fe92a41b Merge pull request #4135 from atom/bo-tab-reorder
Tab reorder
2014-11-10 14:00:45 -08:00
Kevin Sawicki 5689fbf7cc Suggest keyring dependencies
apm now gracefully fails without them being installed and they
are only used for publishing and starring packages.
2014-11-10 13:35:48 -08:00
Ben Ogle af052c79a7 nof 2014-11-10 13:32:58 -08:00
Kevin Sawicki f431bb6396 Add more complete list of Debian dependencies
This list was taken from the webupd8 .deb file

Closes #4114
2014-11-10 13:32:20 -08:00
Ben Ogle e21cc17a7b Add tab-moving key bindings for windows 2014-11-10 13:31:18 -08:00
Ben Ogle 1247e40e88 Add tab-moving key bindings for mac 2014-11-10 13:31:12 -08:00
Ben Ogle 6159209d49 moveItemTo* -> moveItem* 2014-11-10 13:28:15 -08:00
Kevin Sawicki d8263a1fcd ⬆️ apm@0.111 2014-11-10 13:21:23 -08:00
Ardeshir Javaherchi 5e3b88f42d Add another test for moveItemToLeft 2014-11-10 11:25:17 -08:00
Ardeshir Javaherchi a0e4d8b582 Add test for reordering tabs in linux 2014-11-10 11:25:17 -08:00
Ardeshir Javaherchi ff80545285 🐧 Add keymap implementation to reorder tabs in linux 2014-11-10 11:25:16 -08:00
Ben Ogle 3462d99675 Upgrade atom-dark-syntax 2014-11-10 11:16:34 -08:00
Kevin Sawicki 11ec0c579d ⬆️ language-css@0.23 2014-11-10 11:04:11 -08:00
Kevin Sawicki 0de9f54e3c ⬆️ apm@0.110 2014-11-10 11:04:11 -08:00
Ben Ogle 75e499004d Merge pull request #4119 from je-allard/master
🐛 load the bootstrap style for thumbnails
2014-11-10 10:34:38 -08:00
Nathan Sobo 11a817c442 :arrow_up settings-view to revert previous change 2014-11-10 11:16:29 -07:00
Nathan Sobo 8db843a57c ⬆️ settings-view to fix styling 2014-11-10 11:07:11 -07:00
Nathan Sobo 08dd51a12f Merge pull request #4121 from atom/mb-inline-commands-in-palette
Include inline commands in the command palette
2014-11-10 10:25:36 -07:00
Nathan Sobo 3f869ec191 Merge pull request #4105 from atom/ld-doc-update
Remove obsolete jQuery reference in documentation
2014-11-10 10:18:42 -07:00
Nathan Sobo 0fba8ba402 Subscribe to ‘window:open-path’ as a command 2014-11-10 10:10:53 -07:00
Nathan Sobo 7756f4b945 Don’t run ‘beforeunload’ listeners through atom.commands 2014-11-10 10:10:53 -07:00
Nathan Sobo 832e7113f7 Include all inline commands on the bubble path in ::findCommands 2014-11-10 10:10:52 -07:00
Nathan Sobo aa46e3d26f Add atom-pane commands via atom.commands again 2014-11-10 10:10:52 -07:00
Nathan Sobo d48719ab1c Ignore jQuery and duplicates in CommandRegistry::findCommands
Now that jQuery has been patched to add inline listeners and inline
listeners are reported from findCommands, there’s no reason to include
commands based on $.fn.events. Also, we need to ensure the same command
doesn’t get added to the list twice since it could get added by both
inline and selector-based listeners.
2014-11-10 10:09:24 -07:00
Max Brunsfeld 0c40a1ef92 Include inline commands in command palette 2014-11-10 10:09:24 -07:00
Nathan Sobo bad0504e1d Attach active pane item view before showing/hiding
Fixes #4112
2014-11-10 10:06:12 -07:00
Nathan Sobo 01fdd83c6c ⬆️ markdown-preview to fix exception when modifying w/ splits 2014-11-10 08:22:13 -07:00
Nathan Sobo 0a92b6b681 Add Workspace::paneForItem 2014-11-10 08:20:59 -07:00
Nathan Sobo 167467339a Merge pull request #4129 from atom/ns-fix-pane-close
Prompt to save modified items when closing a pane via pane:close
2014-11-10 08:17:56 -07:00
Nathan Sobo efd3329c50 Prompt to save modified items when closing a pane via pane:close
Fixes #4094
2014-11-10 07:55:37 -07:00
Jeremy Allard a140787252 🐛 load the bootstrap style for thumbnails 2014-11-09 01:40:49 -05:00
Lee Dohm d09c4010f6 Remove obsolete jQuery reference
Noticed that "soon" is now
2014-11-07 22:23:12 -08:00
Kevin Sawicki e2f1a245b0 💄 2014-11-07 20:54:03 -08:00
Kevin Sawicki 682045ef16 Prepare 0.145 2014-11-07 20:26:29 -08:00
Kevin Sawicki dc6e825edd ⬆️ encoding-selector@0.6 2014-11-07 19:57:23 -08:00
Nathan Sobo 481e444ffe Reassign context to undefined because CoffeeScript needs a var keyword
Fixes #4100
2014-11-07 18:00:38 -07:00
Nathan Sobo 5193fa698f Merge pull request #4103 from atom/ns-fix-active-pane-deserialization
Make deserialization of the active pane more tolerant and add assertions to catch invalid states
2014-11-07 16:00:40 -07:00
Nathan Sobo b8d2bd6c30 Disallow activation of panes that aren't in the PaneContainer
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-07 15:46:47 -07:00
Nathan Sobo 33fde29acb Disallow activation of destroyed panes
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-07 15:45:21 -07:00
Nathan Sobo 6934b83acc Fall back to first pane if activePaneId is invalid
When deserializing PaneContainer.

Fixes #4069

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-07 15:44:59 -07:00
Nathan Sobo 330988ad16 Merge pull request #4101 from atom/mb-fix-styles
Fix user stylesheet regression due to shadow DOM PR
2014-11-07 14:56:26 -07:00
Nathan Sobo 058ef0a5a8 Fix autocomplete specs 2014-11-07 14:43:02 -07:00
Max Brunsfeld 003c101f14 W/o shadow-dom, don't add global atom-styles element for text editor
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-07 13:05:46 -08:00
Max Brunsfeld 98d602628a Render all stylesheets in atom-styles elements without contexts
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-07 12:56:32 -08:00
Kevin Sawicki 46efc52a22 ⬆️ language-shellscript@0.10 2014-11-07 12:42:13 -08:00
Kevin Sawicki f78891b600 Fetch draft assets from assets URL
This will include assets in a bad state that should still be deleted
and aren't returned from the main release URL.
2014-11-07 12:07:16 -08:00
Kevin Sawicki 05e3bbde45 ⬆️ settings-view@0.156 2014-11-07 11:54:58 -08:00
Ben Ogle 4dc4a022ab Upgrade find-and-replace to use atom-text-editor 2014-11-07 11:09:03 -08:00
Ben Ogle 226ae374c1 Upgrade bookmarks to work with shadow dom 2014-11-07 11:06:03 -08:00
Kevin Sawicki fbfe1c7224 Fully fetch draft release
Assets in a bad state aren't returned from the releases listing
endpoint.
2014-11-07 10:58:53 -08:00
Kevin Sawicki 53f8ae3055 ⬆️ language-sass@0.25 2014-11-07 10:48:24 -08:00
Ben Ogle 1634b3acfc Upgrade git-diff to use atom-text-editor 2014-11-07 10:46:15 -08:00
Kevin Sawicki 3067323564 ⬆️ language-css@0.22 2014-11-07 10:41:36 -08:00
Kevin Sawicki c410b79af0 ⬆️ language-python@0.23 2014-11-07 10:34:45 -08:00
Ben Ogle f09fc23fdc Merge branch 'master' of github.com:atom/atom 2014-11-07 10:16:16 -08:00
Kevin Sawicki a9262b18c2 Prepare 0.144 2014-11-07 10:14:27 -08:00
Ben Ogle ef129f9491 Add more relevant (but contrived) example in init.coffee.
Closes #4089
2014-11-07 10:02:07 -08:00
Ben Ogle b4d38d14e3 Add padding to panel headings 2014-11-07 09:44:32 -08:00
Ben Ogle 97a21d7bbf Merge pull request #4087 from philipgiuliani/patch-1
📝 Update .workspace class with custom element
2014-11-07 09:34:32 -08:00
Nathan Sobo ab395952a9 Dispose of ::scopedConfigSubscriptions when Editor is destroyed 2014-11-07 10:13:38 -07:00
Nathan Sobo 6e55c80d3c Dispose of ::scopedConfigSubscriptions when DisplayBuffer is destroyed 2014-11-07 10:09:55 -07:00
Philip Giuliani f1079056cf Update .workspace class with custom element
Because of the update with the custom elements, i noticed that `.workspace` hasn't been updated in the `keymap.cson`, but `.editor` has (to `atom-text-editor`).
2014-11-07 09:43:46 +01:00
Ben Ogle b29a61ec87 Update deprecation warning test 2014-11-06 15:19:49 -08:00
Max Brunsfeld 4894849adc ⬆️ atom-keymap for multi-modifier keystroke fix
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-06 15:01:34 -08:00
Ben Ogle cf78b01d45 Upgrade find-and-replace to use new APIs 2014-11-06 14:49:13 -08:00
Ben Ogle 1ed927f213 Remove getPath() deprecation in project::scan 2014-11-06 14:49:13 -08:00
Nathan Sobo b978b4f8c7 ⬆️ space-pen for interoperable $.fn.view method
Previously, the SpacePen view was associated with its elements
via $.fn.data, but this only works across a single instance
of jQuery. Now we store a ::spacePenView property as an expando
property directly on elements.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-06 15:28:49 -07:00
Nathan Sobo baea6fcb49 Don’t assume SpacePen views implement ::unsubscribe
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-06 15:28:20 -07:00
Nathan Sobo 7e06e10fcf Don’t require a specific jQuery instance for jasmine jQuery matchers
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-06 15:27:45 -07:00
Nathan Sobo 0bcfa591f6 Always throw exceptions when translating rows on destroyed DisplayBuffer
Previously we only threw exceptions on non-release builds, but we
haven’t seen bundled packages cause issues in a while. Time to see what
third party packages cause problems.

Refs #3192
2014-11-06 12:56:01 -07:00
Ben Ogle f2532b1a35 Upgrade metrics to reduce the noise a bit 2014-11-06 11:46:12 -08:00
Nathan Sobo e0f8d6f365 Fix disappearing editor when folding all
Also: simplify the editor stylesheet a bit. Still some more to do but
fixing this issue is more important.
2014-11-06 12:36:14 -07:00
Ben Ogle 50c705fea4 Remove unnecessary code
cc @nathansobo as you meant to remove this originally
2014-11-06 10:16:11 -08:00
Max Brunsfeld 8bfea240ea Merge pull request #4071 from atom/mb-editor-grouped-undo
Add grouped undo for all text editor commands
2014-11-06 10:13:04 -08:00
Max Brunsfeld 4099828525 ⬆️ text-buffer@3.6.0 2014-11-06 09:55:31 -08:00
Max Brunsfeld 26983adbdf Reduce ambiguity in config description 2014-11-06 09:42:20 -08:00
Kevin Sawicki ede703453a ⬆️ settings-view@0.155 2014-11-06 09:38:36 -08:00
Max Brunsfeld d97c81bf6a Make undo grouping interval configurable 2014-11-06 09:25:10 -08:00
Kevin Sawicki bd76242851 Prepare 0.143 2014-11-06 09:03:35 -08:00
Max Brunsfeld d85c07e7e2 Don't wrap undo/redo calls in transactions 2014-11-05 16:59:06 -08:00
Max Brunsfeld 4077e791c9 Update signature of calls to TextBuffer::transact 2014-11-05 15:58:13 -08:00
Max Brunsfeld e7eef89fa5 Remove TextEditor::withGroupingInterval
Just use ::transact
2014-11-05 15:58:13 -08:00
Max Brunsfeld 5437236304 Use undo grouping in editor command listeners 2014-11-05 15:58:13 -08:00
Max Brunsfeld b7aa421e4e Add TextEditor::withGroupingInterval
This method temporarily instructs the editor to apply undo grouping with
a given interval. This way, undo grouping can be made optional without
adding optional arguments to every buffer manipulation method.
2014-11-05 15:58:12 -08:00
Ben Ogle 9458db0c1f Fix issue removing panels 2014-11-05 15:37:47 -08:00
Ben Ogle 80c15513bb Fix typos 2014-11-05 15:36:39 -08:00
Ben Ogle 951289f67f Upgrade metrics for cohorts, commands, and exceptions 2014-11-05 15:05:31 -08:00
Kevin Sawicki 1e7ba12e60 ⬆️ markdown-preview@0.109 2014-11-05 14:44:22 -08:00
Kevin Sawicki 9a423359c4 ⬆️ markdown-preview@0.108 2014-11-05 14:40:50 -08:00
Kevin Sawicki bb56c6badc ⬆️ language-python@0.22 2014-11-05 12:49:21 -08:00
Nathan Sobo ae461b21a4 ⬆️ find-and-replace for shadow DOM support
@benogle heads-up. Not sure if you didn’t want to update this yet but
I’m assuming it’s fine.
2014-11-05 11:26:56 -07:00
Nathan Sobo 670b44f250 Only set both height and width of editor when shadow DOM is used
These work inside a shadow root, but break the flexbox behavior when
the shadow DOM is disabled.
2014-11-05 11:21:29 -07:00
Kevin Sawicki d330a8fac5 Merge pull request #4006 from atom/atom-shell-v0.19.0
Upgrade to atom-shell@0.19.0
2014-11-05 09:45:31 -08:00
Kevin Sawicki 8bd2650d01 Merge pull request #4064 from atom/pass-path-env
Pass $PATH by command line
2014-11-05 09:40:04 -08:00
Ben Ogle 560d9387dc Upgrade text-buffer to remove deprecations 2014-11-05 09:23:44 -08:00
Nathan Sobo 39cc463e24 Add .editor and .editor-colors classes regardless of shadow DOM setting 2014-11-05 09:57:13 -07:00
Nathan Sobo 2c83c3fe17 Merge pull request #3943 from atom/ns-text-editor-shadow-dom
Render text editor contents inside shadow DOM
2014-11-05 09:42:07 -07:00
Nathan Sobo 07505ea82a Support any instance of jQuery in view registry logic 2014-11-05 09:33:31 -07:00
Nathan Sobo 47d3b3edf3 Add jQueryTrigger: true to command detail in $.fn.trigger patch
Attention: @benogle
References: atom/metrics#32
2014-11-05 09:28:35 -07:00
Ben Ogle 3d394e854e Add 'application:open-dev' binding for windows. 2014-11-05 08:19:24 -08:00
Ben Ogle a37b8ff632 Merge pull request #4068 from jpelgrom/master
Keyboard shortcut to open folder on Windows
2014-11-05 08:18:00 -08:00
jpelgrom f8a05dd8e0 Keyboard shortcut to open folder on Windows
Based on Linux behaviour
2014-11-05 16:05:55 +01:00
Cheng Zhao 6a58f6054a Pass $PATH by command line 2014-11-05 12:11:42 +08:00
Ben Ogle ddd4a9a968 Merge pull request #4063 from atom/bo-unify-panel-styling
Unify panel styling
2014-11-04 17:12:49 -08:00
Ben Ogle 743c50014f Do not import overlay 2014-11-04 16:59:02 -08:00
Ben Ogle af761fb004 All panel styling into panels.less 2014-11-04 15:39:25 -08:00
Nathan Sobo badf1725fa Handle focus on hidden input when shadow DOM is disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:29 -07:00
Nathan Sobo 2b2149bca1 Add config schema for editor.useShadowDOM
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo e1d6d55311 Enable editor.useShadowDOM in all specs 2014-11-04 16:37:28 -07:00
Nathan Sobo 670a710753 Test editor focus/blur handling with shadow DOM enabled/disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo dd1e5338c6 Focus the root TextEditorElement in spec instead of component node
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo 100af7d27d Fix corner cases related to lifecycle state of EditorComponent on events
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo 9b70cf2044 Make blur event on text editor element work with shadow DOM disabled
When the shadow DOM is enabled, this happens organically because the
focus is abstracted across the shadow boundary. Without that abstraction
boundary, we need to pretend that a blur of the hidden input is actually
a blur of the entire editor.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo 7fe9c14772 💄 2014-11-04 16:37:28 -07:00
Nathan Sobo 9690e44ffe Correctly handle focus when shadow DOM is disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Nathan Sobo 0e57ede712 Only create a shadow root if editor.useShadowDOM config setting is true
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Nathan Sobo dd7335c30b Simplify focus/blur handling
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Ben Ogle 4537e9bd1a Fix specs 2014-11-04 16:37:27 -07:00
Nathan Sobo 0488fc21da ⬆️ autocomplete for shadow DOM fix with auto-selecting 1 option 2014-11-04 16:37:27 -07:00
Nathan Sobo 160bb29034 Null-guard component in blur handler 2014-11-04 16:37:27 -07:00
Nathan Sobo 497b4a4e24 Toggle quotes back 2014-11-04 16:37:27 -07:00
Nathan Sobo dd4e7d6921 Wait for promise resolution on all calls to activatePackage
This avoids a race condition where stylesheets would be added after all
packages were deactivated and leak into the next spec.
2014-11-04 16:37:26 -07:00
Nathan Sobo d060ecdc24 Assign package stylesheet context based on double-extension in file name
If stylesheet files are named with 2 extensions, the first extension is
used as the context argument when the package’s stylesheets are loaded.
This allows people to target the text editor by naming their stylesheet
`index.atom-text-editor.less`.
2014-11-04 16:37:26 -07:00
Nathan Sobo 84d1101903 Upgrade package-generator to fix specs with shadow DOM 2014-11-04 16:37:26 -07:00
Nathan Sobo 6f3c53a17a Only cancel focus events if the editor is or contains the related target 2014-11-04 16:37:26 -07:00
Nathan Sobo dd17e8f018 Replace focusout event handlers on hiddenInput shim with blur handlers
The focusout event doesn’t seem to work for elements in the shadow DOM.
Other people seem to share this experience:

https://code.google.com/p/chromium/issues/detail?id=378163#c7
2014-11-04 16:37:26 -07:00
Nathan Sobo cf3f1aa2eb Don’t handle text editor focus when it already has focus 2014-11-04 16:37:26 -07:00
Nathan Sobo adaf1829da Determine focus using document.activeElement instead of component state 2014-11-04 16:37:26 -07:00
Nathan Sobo 7863db480e Override jQuery.contains instead of jQuery.fn.position
Turns out the problems with position inside the shadow DOM are due to
the fact that elements in the light DOM don’t claim to contain elements
from a shadow DOM, causing jQuery.fn.offset to bail out early and
misreport positions inside the editor.
2014-11-04 16:37:26 -07:00
Nathan Sobo 5cc243ec11 Inject both underlayer and overlayer via shadow DOM insertion points 2014-11-04 16:37:25 -07:00
Nathan Sobo 2e46cf9b8d Refefine $.fn.position in terms of offsetTop/Left to work w/ shadow DOM
The default implementation of position seems to barf when things are in
the shadow DOM. This seems to be a suitable replacement that doesn’t.
2014-11-04 16:37:25 -07:00
Nathan Sobo 5e8655fa60 Don’t use :focus selector to store previously focused element 2014-11-04 16:37:25 -07:00
Nathan Sobo c64a4b7ca9 Fallback to light DOM in TextEditorView::find if nothing found in shadow 2014-11-04 16:37:25 -07:00
Nathan Sobo bda1429293 Trigger ‘blur’ on select list editor instead of ‘focusut’ on its input 2014-11-04 16:37:25 -07:00
Nathan Sobo eb19989ecd Handle focus at the host element level
Detecting focus and blur at the level of the input is creating problems
when we blur and then immediately refocus. This is simpler.
2014-11-04 16:37:25 -07:00
Nathan Sobo 62c0db11ee Define enter as ‘core:confirm’ in select-list mini editors
We were leaving this to packages to define, and they were getting it
wrong by selecting into the ‘input’ which is now in shadow.
2014-11-04 16:37:25 -07:00
Nathan Sobo 8aeabe5fe5 Listen for ‘blur’ on mini editor of select list rather than ‘focusout’
The focusout handler on the mini editor’s hidden input wasn’t being
triggered, but we can listen for blur directly on the editor now that
the shadow DOM abstracts the focus.
2014-11-04 16:37:25 -07:00
Nathan Sobo ab846a2495 Put views appended via appendToLinesView in the light DOM
This adds an insertion point to the lines div via a <content> tag,
allowing immediate children of the editor tag to be positioned relative
to the lines div but still be styled via global CSS.
2014-11-04 16:37:24 -07:00
Nathan Sobo 7202908780 Split editor stylesheet into light and shadow DOM versions
This prevents the need for a :host pseudo-class in the editor CSS which
breaks linting. It also fits selectors targeting the host element in a
more intuitive spot in the cascade.
2014-11-04 16:37:24 -07:00
Nathan Sobo c4cfac5615 Use event capture for pane focus/blur events
Focusin/focusout don’t seem to bubble properly across shadow DOM
boundaries, so capturing is a more reliable alternative.
2014-11-04 16:37:24 -07:00
Nathan Sobo 866f2d9a76 Fix appendToLinesView 2014-11-04 16:37:24 -07:00
Nathan Sobo 3b455c00d3 Proxy TextEditorView::find calls to the root inside the shadow DOM 2014-11-04 16:37:24 -07:00
Nathan Sobo 1f777addd9 Sample font styling when font config values change
We previously could do it whenever stylesheets changed, but these values
end up getting assigned to the global stylesheet for cascading reasons
and we’re only watching the local stylesheet. We poll the host elements
DOM properties, but forcing a sync poll when the config values change
makes behavior synchronous for specs and more responsive when changing
these values.
2014-11-04 16:37:24 -07:00
Nathan Sobo 58744f6b7b Account for shadow DOM when asserting on focus 2014-11-04 16:37:24 -07:00
Nathan Sobo 7badd9ba25 Don’t rely on :focus selector for toHaveFocus matcher
:focus doesn’t work properly when focus is inside the shadow DOM of
an element, but document.activeElement does.
2014-11-04 16:37:23 -07:00
Nathan Sobo e8d7058383 Go back to the plain “theme” group for theme stylesheets 2014-11-04 16:37:23 -07:00
Nathan Sobo 42fc54f716 Protect against stylesheets changing while detached 2014-11-04 16:37:23 -07:00
Nathan Sobo c11675dca1 Don’t recycle the same composite disposable for stylesheet activation 2014-11-04 16:37:23 -07:00
Nathan Sobo cdb62812d2 Don’t use syntax themes in spec because they are inserted in shadow DOM 2014-11-04 16:37:23 -07:00
Nathan Sobo 2d3d64f399 Call reloadStylesheets instead of reloadStylesheet in spec 2014-11-04 16:37:23 -07:00
Nathan Sobo 2321aa2bee Get SpacePen outlet shims from inside shadow DOM 2014-11-04 16:37:23 -07:00
Nathan Sobo fa733c85ad Fix setEditorHeightInLines shim now that we’ve dropped .react class 2014-11-04 16:37:23 -07:00
Nathan Sobo 158bbef38f Account for shadow dom when asserting active element 2014-11-04 16:37:22 -07:00
Nathan Sobo b2bc09c13d Apply stylesheets with atom-editor-context in text editor specs 2014-11-04 16:37:22 -07:00
Nathan Sobo 268fceb073 Specify border-box sizing for the cursor to fix specs 2014-11-04 16:37:22 -07:00
Nathan Sobo 5be21d6743 Avoid traversing through shadow root on mousewheel events 2014-11-04 16:37:22 -07:00
Nathan Sobo 5d3602d37b Get node once to attach event handlers 2014-11-04 16:37:22 -07:00
Nathan Sobo b86f6870c5 Use native event handlers instead of React
React event handlers don’t work because of the shadow DOM
2014-11-04 16:37:22 -07:00
Nathan Sobo 2ab5fa405c Apply mini and is-focused class to both editor host element and root
This preserves existing theming behavior
2014-11-04 16:37:22 -07:00
Nathan Sobo 5f4fb23057 Initialize atom-styles element in editor shadow dom before measuring 2014-11-04 16:37:22 -07:00
Nathan Sobo 22f6268116 Assign StylesElement::context on attachment 2014-11-04 16:37:21 -07:00
Nathan Sobo 65f40d6f7b Move font styling to host element so font preferences work 2014-11-04 16:37:21 -07:00
Nathan Sobo 596987fbce Fix sourcePath on text editor stylesheet loading 2014-11-04 16:37:21 -07:00
Nathan Sobo 2b218d2e01 Only update atom-styles children on context attribute change if attached 2014-11-04 16:37:21 -07:00
Nathan Sobo 582066915b Apply syntax theme stylesheets in text editor shadow DOM via atom.styles 2014-11-04 16:37:21 -07:00
Nathan Sobo 1a98cb7070 Use atom.styles to activate stylesheets in packages 2014-11-04 16:37:21 -07:00
Nathan Sobo c2d0b6d4f5 Load editor stylesheet in shadow root with style manager context param 2014-11-04 16:37:21 -07:00
Nathan Sobo 2affff30ff Handle events with native handlers to avoid shadow DOM issues with React 2014-11-04 16:37:21 -07:00
Nathan Sobo 3b6189e94b Create WeakMap on element creation to support ‘context’ attribute change 2014-11-04 16:37:21 -07:00
Nathan Sobo 4e8e5a84c4 Support context attribute in <atom-styles> 2014-11-04 16:37:20 -07:00
Nathan Sobo 087387e633 Style mini editor font sizes on atom-text-editor host element
…instead of via the shadow DOM. We always honor the computed font
styles of the host element.
2014-11-04 16:37:20 -07:00
Nathan Sobo 769c6c52bb Make atom-text-editor have “display: block” 2014-11-04 16:37:20 -07:00
Nathan Sobo 963c92eb4e Hack: Add editor stylesheets to atom-text-editor shadow root 2014-11-04 16:37:20 -07:00
Nathan Sobo 22212be90d Give atom-text-editor elements a shadow root
Themes aren’t applying correctly and there are issues with mini editors
but this basically works. I’m leaving the .editor node in the shadow
DOM for theme compatibility and because React still wants to render
into a wrapper element.
2014-11-04 16:37:20 -07:00
Ben Ogle 8a640b35e0 Merge pull request #4061 from atom/bo-modal-panel
Modal panel API
2014-11-04 15:34:43 -08:00
Ben Ogle df9a0dc7a3 hideAllPanelsExcept 2014-11-04 15:22:32 -08:00
Ben Ogle 5251183410 Dispose panel emitter on destroy() 2014-11-04 15:21:32 -08:00
Ben Ogle 5bd028b24e Enforce modal 2014-11-04 14:58:00 -08:00
Ben Ogle 8485831f40 Add the location attr. Need it for styling! 2014-11-04 14:22:15 -08:00
Ben Ogle da30b66ffa Fix tests 2014-11-04 14:10:58 -08:00
Ben Ogle 3da11bf478 Update styles for modal panels. 2014-11-04 14:04:15 -08:00
Ben Ogle 9b1d5e1864 Add addModalPanel to atom.workspace. 2014-11-04 13:48:48 -08:00
Ben Ogle 1f445acc12 Merge pull request #4060 from atom/bo-remove-some-bootstrap
Only load the bootstrap styles we need
2014-11-04 13:47:44 -08:00
Ben Ogle 022bc2e2a5 Only load the bootstrap styles we need! 2014-11-04 12:28:53 -08:00
Cheng Zhao da18db754f ⬆️ atom-shell@0.19.1 2014-11-04 21:02:46 +08:00
Cheng Zhao c20403d983 ⬆️ atom-shell@0.19.0 2014-11-04 21:02:46 +08:00
Ben Ogle 78dc87d4b6 Add new event method for unhandled errors. 2014-11-03 16:18:20 -08:00
Kevin Sawicki 5dd310f9ac ⬆️ language-shellscript@0.9 2014-11-03 10:42:04 -08:00
Kevin Sawicki 427a32c336 ⬆️ language-javascript@0.43 2014-10-31 16:13:34 -07:00
Kevin Sawicki f3d4a3ad45 ⬆️ language-c@0.30 2014-10-31 16:09:55 -07:00
Ben Ogle ba642682ca Merge pull request #4014 from atom/bo-undo-skip
Pass options through to TextBuffer::setTextInRange
2014-10-31 12:19:28 -07:00
Ben Ogle b1a0258ad4 Clean up spec name 2014-10-31 11:39:56 -07:00
Kevin Sawicki 44112f2ecd Merge pull request #4023 from atom/ks-map-assets-directory-to-atom-protocol
Load atom://assets/ urls from ~/.atom/assets
2014-10-31 11:39:39 -07:00
Ben Ogle 54b8aa4a02 Add spec for skip 2014-10-31 11:38:24 -07:00
Ben Ogle 5791548ac4 Upgrade to text-buffer@3.5.0 2014-10-31 11:33:03 -07:00
Kevin Sawicki 26f21abcf3 Remove ivar only used in constructor 2014-10-31 11:24:26 -07:00
Kevin Sawicki ab0f9e88a7 Add dot atom directory ivar 2014-10-31 10:56:03 -07:00
Kevin Sawicki 6d8b891b65 💄 2014-10-31 10:43:07 -07:00
Kevin Sawicki afdb96e1b1 Don't load from ~/.atom/dev when in safe mode 2014-10-31 10:42:27 -07:00
Kevin Sawicki 9c1ca86cb0 Load atom://assets/ urls from ~/.atom/assets 2014-10-31 10:35:15 -07:00
Kevin Sawicki 4e95977fbd Merge pull request #4018 from ardeshirj/mkrpm
Remove rpm package dependencies
2014-10-31 09:48:34 -07:00
Kevin Sawicki 4a8a379891 ⬆️ symbols-view@0.67 2014-10-31 09:05:32 -07:00
Ardeshir Javaherchi fb0387f43e Remove rpm package dependencies 2014-10-30 23:26:52 -07:00
Ben Ogle 5231a548e3 Pass options through to the text buffer 2014-10-30 17:49:43 -07:00
Kevin Sawicki a466d6cdaf ⬆️ tree-view@0.132 2014-10-30 17:00:36 -07:00
Kevin Sawicki 19b0f760a1 Only re-tokenize lines when tab length changes
Closes #3929
2014-10-30 16:20:05 -07:00
Kevin Sawicki 228ba5f96a ⬆️ language-php@0.18 2014-10-30 15:43:14 -07:00
Kevin Sawicki 25922872f0 Remove trailing whitespace 2014-10-30 14:00:53 -07:00
Ben Ogle 15a1982e8c Merge pull request #4012 from atom/bo-move-view-registry
Move the ViewRegistry to atom.views
2014-10-30 13:56:52 -07:00
Ben Ogle fcca61c2b2 📝 Update docs 2014-10-30 13:56:03 -07:00
Ben Ogle ee4116536d Move the ViewRegistry to atom.views 2014-10-30 13:42:27 -07:00
Kevin Sawicki c217c6544a Prepare 0.142 2014-10-30 13:35:40 -07:00
Kevin Sawicki 205095a198 ⬆️ encoding-selector@0.5 2014-10-30 11:03:35 -07:00
Kevin Sawicki 4326898d5f ⬆️ grammar-selector@0.37 2014-10-30 11:02:15 -07:00
Kevin Sawicki b8285a00b0 Require path after setting start time 2014-10-30 10:49:08 -07:00
Kevin Sawicki 025967193a Add path require to top 2014-10-30 10:48:51 -07:00
Kevin Sawicki 75627f50a2 Normalize process.resourcesPath on load
This ensures the drive letter is consistent on Windows for when
package paths are compared to the resources path to determine
whether to use the metadata cache for a bundled package.

Closes #3932
2014-10-30 10:31:37 -07:00
Kevin Sawicki 9fca1d26f1 ⬆️ dev-live-reload@0.35 2014-10-30 10:22:26 -07:00
Kevin Sawicki 6e827434fd Log a warning when a enabled theme isn't installed 2014-10-30 10:04:38 -07:00
Kevin Sawicki b3f6b3af4b Merge pull request #3968 from lee-dohm/default-themes
Load the default themes when configured themes don't exist
2014-10-30 09:38:11 -07:00
Kevin Sawicki 63a33bd1e7 Merge pull request #3997 from atom/ks-remove-feedback-package
Remove feedback package
2014-10-30 09:26:17 -07:00
Kevin Sawicki a153f1e244 Move items around in help menu a bit 2014-10-30 09:11:06 -07:00
Kevin Sawicki 037a7f435c Add search issues to help menu 2014-10-30 09:11:06 -07:00
Kevin Sawicki 7641f1d1e4 Sync help menus on Linux/Windows 2014-10-30 09:11:06 -07:00
Kevin Sawicki 05c1ae71e1 Add report issue to Help menu 2014-10-30 09:11:05 -07:00
Kevin Sawicki cefabd4eb8 Add FAQ to help menu 2014-10-30 09:11:05 -07:00
Kevin Sawicki 9f80be4570 Add roadmap to help menu 2014-10-30 09:11:05 -07:00
Kevin Sawicki 61f75b0764 Add discussions to Help menu 2014-10-30 09:11:05 -07:00
Kevin Sawicki ae2f4ac36e Remove feedback package 2014-10-30 09:11:05 -07:00
Lee Dohm d20e91897a Load the default themes when configured themes don't exist 2014-10-29 19:42:42 -07:00
Kevin Sawicki 2e0bb66a9a Remove unneeded add encoding attr call 2014-10-29 16:03:57 -07:00
Kevin Sawicki d205c4d664 Add data attribute for encoding
Mirrors the grammar data attribute
2014-10-29 16:03:10 -07:00
Kevin Sawicki 8db5ea7bc7 ⬆️ encoding-selector@0.4 2014-10-29 14:59:26 -07:00
Nathan Sobo 3c7eecbb6a Dispose of scoped config subscriptions when TextEditorComponent unmounts
Fixes #3998
2014-10-29 15:04:39 -06:00
Kevin Sawicki 8dab3d90b3 ⬆️ grammar-selector@0.36 2014-10-29 13:58:29 -07:00
Kevin Sawicki 44bc470a00 ⬆️ encoding-selector@0.3 2014-10-29 13:39:26 -07:00
Kevin Sawicki 498631725a Store menu template even if window isn't focused
update may be called before the window gains focus to store its
template so it is updated correcltly once the window gains focus.
2014-10-29 13:06:57 -07:00
Kevin Sawicki 945345b0c7 📝 Update documentation styleguide 2014-10-29 11:59:25 -07:00
Kevin Sawicki 6576ec5cde Merge pull request #3987 from atom/ks-encodings
Add support for changing editor encoding
2014-10-29 11:58:31 -07:00
Kevin Sawicki ce8143f8e6 Add TextEditor::onDidChangeEncoding spec 2014-10-29 11:33:01 -07:00
Kevin Sawicki e993175205 💄 2014-10-29 11:33:01 -07:00
Kevin Sawicki 4242ac0911 🔨 Add jschardet license override 2014-10-29 11:33:01 -07:00
Kevin Sawicki f22e741a9b Bundle encoding-selector package 2014-10-29 11:33:01 -07:00
Kevin Sawicki a41b582032 ⬆️ text-buffer@3.4 2014-10-29 11:33:01 -07:00
Kevin Sawicki a24279d0b9 ⬆️ pathwatcher@2.3.2 2014-10-29 11:33:01 -07:00
Kevin Sawicki 5985175b07 📝 Fix typo 2014-10-29 11:33:01 -07:00
Kevin Sawicki d2ef888f22 Add TextEditor::onDidChangeEncoding 2014-10-29 11:33:01 -07:00
Kevin Sawicki 35925ed349 Add encoding getter and setter 2014-10-29 11:33:01 -07:00
Kevin Sawicki 490ec1aac7 ⬆️ pathwatcher@2.3.1 2014-10-29 11:33:01 -07:00
Kevin Sawicki 25eea7d19b Remove TextEditor::setEncoding 2014-10-29 11:33:01 -07:00
Kevin Sawicki 4c9e71770a Add initial TextEditor::setEncoding 2014-10-29 11:33:00 -07:00
Kevin Sawicki 4032d96b13 ⬆️ image-view@0.40 2014-10-29 11:32:49 -07:00
Kevin Sawicki c5aa3eb441 ⬆️ image-view@0.39 2014-10-29 11:27:55 -07:00
Kevin Sawicki 68bb765304 ⬆️ settings-view@0.154 2014-10-29 11:03:58 -07:00
Kevin Sawicki bd7996e071 Remove open profile 2014-10-29 10:55:46 -07:00
Kevin Sawicki 1eaba0cb52 ⬆️ fuzzy-finder@0.60 2014-10-29 10:36:09 -07:00
Kevin Sawicki 0c590d6170 Load CoffeeScript when using a custom resource path
Load CoffeeScript early whenever the resource path a subdirectory
from process.resourcesPath

Close #3993
2014-10-29 10:21:23 -07:00
Kevin Sawicki 3df72ec173 ⬆️ apm@0.109 2014-10-29 09:51:59 -07:00
Kevin Sawicki 1456bf0d91 📝 runnung -> running 2014-10-29 09:01:18 -07:00
Kevin Sawicki edec6b9b0a 🐎 Use cached pair character information
Tokenized lines break out atomic tokens so trust the hasPairCharacter
value on the token instead of rechecking it.
2014-10-28 18:15:13 -07:00
Kevin Sawicki 9abc4580f4 Don't recompute pair boolean when building token
Pass in hasPairedCharacter to the Token constructor when it is
being broken out from the parent token instead of recomputing it.
2014-10-28 18:15:13 -07:00
Nathan Sobo 54260230c6 ⬆️ git-diff to prevent updating diffs on destroyed editors 2014-10-28 19:08:30 -06:00
Kevin Sawicki 9bd11fc2f7 Merge pull request #3989 from Bengt/patch-1
Add initial instructions to build rpm from sources, ...
2014-10-28 17:10:22 -07:00
Bengt Lüers 81586d22f4 Add initial instructions to build rpm from sources, add packaging dependency for Fedora 2014-10-29 01:09:21 +01:00
Kevin Sawicki dc824485aa Pass character codes around in TextUtils
Previously the character codes were looked up for each type of character pair.
2014-10-28 16:55:36 -07:00
Kevin Sawicki d1fcfabf0b Move comment above module.exports
Make it parseable by donna

Refs atom/donna#2
2014-10-28 16:20:11 -07:00
Nathan Sobo ea8a3a78da Don’t hide pane items that are already hidden 2014-10-28 11:23:35 -06:00
Kevin Sawicki 62f5d0f7f3 ⬆️ go-to-line@0.26 2014-10-27 16:18:21 -07:00
Kevin Sawicki b3f4d03a82 Add Red Hat install instructions
0.140 include an .rpm file on the releases page and this adds back
the install text added by @ardeshirj in #3797
2014-10-27 16:08:21 -07:00
Kevin Sawicki c2d51858b1 ⬆️ markdown-preview@0.107 2014-10-27 15:25:14 -07:00
Kevin Sawicki a5bca03a46 Prepare 0.141 2014-10-27 15:12:44 -07:00
98 arquivos alterados com 1994 adições e 1086 exclusões
+6 -13
Ver Arquivo
@@ -101,30 +101,23 @@ For more information on how to work with Atom's official packages, see
## Documentation Styleguide
* Use [TomDoc](http://tomdoc.org).
* Use [AtomDoc](https://github.com/atom/atomdoc).
* Use [Markdown](https://daringfireball.net/projects/markdown).
* Reference methods and classes in markdown with the custom `{}` notation:
* Reference classes with `{ClassName}`
* Reference instance methods with `{ClassName::methodName}`
* Reference class methods with `{ClassName.methodName}`
* Delegate to comments elsewhere with `{Delegates to: ClassName.methodName}`
style notation.
### Example
```coffee
# Public: Disable the package with the given name.
#
# This method emits multiple events:
#
# * `package-will-be-disabled` - before the package is disabled.
# * `package-disabled` - after the package is disabled.
#
# name - The {String} name of the package to disable.
# options - The {Object} with disable options (default: {}):
# :trackTime - `true` to track the amount of time disabling took.
# :ignoreErrors - `true` to catch and ignore errors thrown.
# callback - The {Function} to call after the package has been disabled.
# * `name` The {String} name of the package to disable.
# * `options` (optional) The {Object} with disable options (default: {}):
# * `trackTime` A {Boolean}, `true` to track the amount of time taken.
# * `ignoreErrors` A {Boolean}, `true` to catch and ignore errors thrown.
# * `callback` The {Function} to call after the package has been disabled.
#
# Returns `undefined`.
disablePackage: (name, options, callback) ->
+11
Ver Arquivo
@@ -39,6 +39,17 @@ Currently only a 64-bit version is available.
The Linux version does not currently automatically update so you will need to
repeat these steps to upgrade to future releases.
### Red Hat Linux (Fedora, CentOS, Red Hat)
Currently only a 64-bit version is available.
1. Download `atom.x86_64.rpm` from the [Atom releases page](https://github.com/atom/atom/releases/latest).
2. Run `sudo yum localinstall atom.x86_64.rpm` on the downloaded package.
3. Launch Atom using the installed `atom` command.
The Linux version does not currently automatically update so you will need to
repeat these steps to upgrade to future releases.
## Building
* [Linux](docs/build-instructions/linux.md)
+1 -1
Ver Arquivo
@@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "0.108.0"
"atom-package-manager": "0.111.0"
}
}
+1 -1
Ver Arquivo
@@ -63,7 +63,7 @@ if [ $OS == 'Mac' ]; then
"$ATOM_PATH/$ATOM_APP_NAME/Contents/MacOS/Atom" --executed-from="$(pwd)" --pid=$$ "$@"
exit $?
else
open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ "$@"
open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ --path-environment="$PATH" "$@"
fi
elif [ $OS == 'Linux' ]; then
SCRIPT=$(readlink -f "$0")
+1 -1
Ver Arquivo
@@ -7,7 +7,7 @@ describe "editorView.", ->
beforeEach ->
atom.workspaceViewParentSelector = '#jasmine-content'
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.attachToDom()
atom.workspaceView.width(1024)
+15
Ver Arquivo
@@ -60,3 +60,18 @@ module.exports =
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""
'jschardet@1.1.0':
license: 'LGPL'
source: 'README.md in the repository'
sourceText: """
JsChardet
=========
Port of python's chardet (http://chardet.feedparser.org/).
License
-------
LGPL
"""
+16 -4
Ver Arquivo
@@ -123,10 +123,22 @@ getAtomDraftRelease = (callback) ->
logError('Fetching atom/atom releases failed', error, releases)
callback(error)
else
for release in releases when release.draft
callback(null, release)
return
callback(new Error('No draft release in atom/atom repo'))
[firstDraft] = releases.filter ({draft}) -> draft
if firstDraft?
options =
uri: firstDraft.assets_url
method: 'GET'
headers: defaultHeaders
json: true
request options, (error, response, assets=[]) ->
if error? or response.statusCode isnt 200
logError('Fetching draft release assets failed', error, assets)
callback(error ? new Error(response.statusCode))
else
firstDraft.assets = assets
callback(null, firstDraft)
else
callback(new Error('No draft release in atom/atom repo'))
deleteRelease = (release) ->
options =
+10 -4
Ver Arquivo
@@ -19,9 +19,9 @@ Ubuntu LTS 12.04 64-bit is the recommended platform.
* `sudo apt-get install build-essential git libgnome-keyring-dev fakeroot`
* Instructions for [Node.js](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#ubuntu-mint-elementary-os).
### Fedora
### Fedora / CentOS / RHEL
* `sudo yum --assumeyes install make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel`
* `sudo yum --assumeyes install make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel rpmdevtools`
* Instructions for [Node.js](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#fedora).
### Arch
@@ -61,13 +61,19 @@ If you have problems with permissions don't forget to prefix with `sudo`
sudo script/grunt install
```
5. *Optionally*, you may generate a `.deb` package at `$TMPDIR/atom-build`:
To use the newly installed Atom, quit and restart all running Atom instances.
5. *Optionally*, you may generate distributable packages of Atom at `$TMPDIR/atom-build`. Currenty, `.deb` and `.rpm` package types are supported. To create a `.deb` package run:
```sh
script/grunt mkdeb
```
Use the newly installed Atom by fully quitting Atom and then reopening.
To create an `.rpm` package run
```sh
script/grunt mkrpm
```
## Advanced Options
+4 -7
Ver Arquivo
@@ -4,11 +4,8 @@
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
# An example hack to log to the console when each text editor is saved.
#
# path = require 'path'
#
# atom.workspaceView.eachEditorView (editorView) ->
# editor = editorView.getEditor()
# if path.extname(editor.getPath()) is '.md'
# editor.setSoftWrapped(true)
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# console.log "Saved! #{editor.getPath()}"
+1 -1
Ver Arquivo
@@ -12,7 +12,7 @@
# 'atom-text-editor':
# 'enter': 'editor:newline'
#
# '.workspace':
# 'atom-workspace':
# 'ctrl-shift-p': 'core:move-up'
# 'ctrl-p': 'core:move-down'
#
+3
Ver Arquivo
@@ -15,6 +15,9 @@
'shift-tab': 'editor:outdent-selected-rows'
'ctrl-K': 'editor:delete-line'
'.select-list atom-text-editor.mini':
'enter': 'core:confirm'
'.tool-panel.panel-left, .tool-panel.panel-right':
'escape': 'tool-panel:unfocus'
+2
Ver Arquivo
@@ -29,6 +29,8 @@
'ctrl-alt-cmd-l': 'window:reload'
'alt-cmd-i': 'window:toggle-dev-tools'
'cmd-alt-ctrl-p': 'window:run-package-specs'
'ctrl-shift-left': 'pane:move-item-left'
'ctrl-shift-right': 'pane:move-item-right'
# Sublime Parity
'cmd-,': 'application:show-settings'
+2
Ver Arquivo
@@ -12,6 +12,8 @@
'ctrl-alt-s': 'application:run-all-specs'
'ctrl-alt-o': 'application:open-dev'
'ctrl-shift-o': 'application:open-folder'
'ctrl-shift-pageup': 'pane:move-item-left'
'ctrl-shift-pagedown': 'pane:move-item-right'
'F11': 'window:toggle-full-screen'
# Sublime Parity
+4
Ver Arquivo
@@ -14,6 +14,10 @@
'ctrl-alt-i': 'window:toggle-dev-tools'
'ctrl-alt-p': 'window:run-package-specs'
'ctrl-alt-s': 'application:run-all-specs'
'ctrl-alt-o': 'application:open-dev'
'ctrl-shift-o': 'application:open-folder'
'ctrl-shift-left': 'pane:move-item-left'
'ctrl-shift-right': 'pane:move-item-right'
'F11': 'window:toggle-full-screen'
# Sublime Parity
+6
Ver Arquivo
@@ -190,6 +190,12 @@
submenu: [
{ label: 'Terms of Use', command: 'application:open-terms-of-use' }
{ label: 'Documentation', command: 'application:open-documentation' }
{ label: 'Roadmap', command: 'application:open-roadmap' }
{ label: 'Frequently Asked Questions', command: 'application:open-faq' }
{ type: 'separator' }
{ label: 'Community Discussions', command: 'application:open-discussions' }
{ label: 'Report Issue', command: 'application:report-issue' }
{ label: 'Search Issues', command: 'application:search-issues' }
{ type: 'separator' }
]
}
+6
Ver Arquivo
@@ -147,6 +147,12 @@
{ label: "VERSION", enabled: false }
{ type: 'separator' }
{ label: '&Documentation', command: 'application:open-documentation' }
{ label: 'Roadmap', command: 'application:open-roadmap' }
{ label: 'Frequently Asked Questions', command: 'application:open-faq' }
{ type: 'separator' }
{ label: 'Community Discussions', command: 'application:open-discussions' }
{ label: 'Report Issue', command: 'application:report-issue' }
{ label: 'Search Issues', command: 'application:search-issues' }
{ type: 'separator' }
]
}
+7 -1
Ver Arquivo
@@ -109,7 +109,7 @@
{ label: 'Focus Pane On Left', command: 'window:focus-pane-on-left' }
{ label: 'Focus Pane On Right', command: 'window:focus-pane-on-right' }
{ type: 'separator' }
{ label: 'Close pane', command: 'pane:close' }
{ label: 'Close Pane', command: 'pane:close' }
]
}
{
@@ -165,6 +165,12 @@
{ label: "VERSION", enabled: false }
{ type: 'separator' }
{ label: '&Documentation', command: 'application:open-documentation' }
{ label: 'Roadmap', command: 'application:open-roadmap' }
{ label: 'Frequently Asked Questions', command: 'application:open-faq' }
{ type: 'separator' }
{ label: 'Community Discussions', command: 'application:open-discussions' }
{ label: 'Report Issue', command: 'application:report-issue' }
{ label: 'Search Issues', command: 'application:search-issues' }
{ type: 'separator' }
]
}
+31 -31
Ver Arquivo
@@ -1,7 +1,7 @@
{
{
"name": "atom",
"productName": "Atom",
"version": "0.140.0",
"version": "0.146.0",
"description": "A hackable text editor for the 21st Century.",
"main": "./src/browser/main.js",
"repository": {
@@ -17,10 +17,10 @@
"url": "http://github.com/atom/atom/raw/master/LICENSE.md"
}
],
"atomShellVersion": "0.18.2",
"atomShellVersion": "0.19.1",
"dependencies": {
"async": "0.2.6",
"atom-keymap": "^2.2.1",
"atom-keymap": "^2.2.2",
"bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372",
"clear-cut": "0.4.0",
"coffee-script": "1.7.0",
@@ -43,7 +43,7 @@
"nslog": "^1.0.1",
"oniguruma": "^3.0.4",
"optimist": "0.4.0",
"pathwatcher": "^2.1.3",
"pathwatcher": "^2.3.2",
"property-accessors": "^1",
"q": "^1.0.1",
"random-words": "0.0.1",
@@ -56,15 +56,15 @@
"season": "^1.0.2",
"semver": "2.2.1",
"serializable": "^1",
"space-pen": "3.8.0",
"space-pen": "3.8.1",
"temp": "0.7.0",
"text-buffer": "^3.3.0",
"text-buffer": "^3.6.0",
"theorist": "^1.0.2",
"underscore-plus": "^1.6.1",
"vm-compatibility-layer": "0.1.0"
},
"packageDependencies": {
"atom-dark-syntax": "0.20.0",
"atom-dark-syntax": "0.21.0",
"atom-dark-ui": "0.35.0",
"atom-light-syntax": "0.21.0",
"atom-light-ui": "0.30.0",
@@ -73,67 +73,67 @@
"solarized-dark-syntax": "0.22.0",
"solarized-light-syntax": "0.12.0",
"archive-view": "0.37.0",
"autocomplete": "0.32.0",
"autocomplete": "0.33.0",
"autoflow": "0.18.0",
"autosave": "0.18.0",
"background-tips": "0.17.0",
"bookmarks": "0.28.0",
"bookmarks": "0.30.0",
"bracket-matcher": "0.62.0",
"command-palette": "0.27.0",
"deprecation-cop": "0.11.0",
"dev-live-reload": "0.34.0",
"dev-live-reload": "0.35.0",
"encoding-selector": "0.7.0",
"exception-reporting": "0.20.0",
"feedback": "0.33.0",
"find-and-replace": "0.141.0",
"fuzzy-finder": "0.58.0",
"git-diff": "0.41.0",
"go-to-line": "0.25.0",
"grammar-selector": "0.35.0",
"image-view": "0.38.0",
"find-and-replace": "0.146.0",
"fuzzy-finder": "0.60.0",
"git-diff": "0.43.0",
"go-to-line": "0.26.0",
"grammar-selector": "0.37.0",
"image-view": "0.40.0",
"incompatible-packages": "0.10.0",
"keybinding-resolver": "0.20.0",
"link": "0.26.0",
"markdown-preview": "0.106.0",
"metrics": "0.36.0",
"markdown-preview": "0.110.0",
"metrics": "0.38.0",
"open-on-github": "0.30.0",
"package-generator": "0.31.0",
"package-generator": "0.32.0",
"release-notes": "0.36.0",
"settings-view": "0.153.0",
"settings-view": "0.159.0",
"snippets": "0.56.0",
"spell-check": "0.43.0",
"status-bar": "0.46.0",
"styleguide": "0.30.0",
"symbols-view": "0.66.0",
"symbols-view": "0.68.0",
"tabs": "0.55.0",
"timecop": "0.23.0",
"tree-view": "0.131.0",
"tree-view": "0.132.0",
"update-package-dependencies": "0.6.0",
"welcome": "0.19.0",
"whitespace": "0.26.0",
"wrap-guide": "0.23.0",
"language-c": "0.29.0",
"language-c": "0.30.0",
"language-coffee-script": "0.37.0",
"language-css": "0.21.0",
"language-css": "0.23.0",
"language-gfm": "0.53.0",
"language-git": "0.9.0",
"language-go": "0.19.0",
"language-html": "0.26.0",
"language-hyperlink": "0.12.0",
"language-java": "0.11.0",
"language-javascript": "0.42.0",
"language-javascript": "0.43.0",
"language-json": "0.8.0",
"language-less": "0.18.0",
"language-make": "0.12.0",
"language-mustache": "0.10.0",
"language-objective-c": "0.11.0",
"language-perl": "0.9.0",
"language-php": "0.17.0",
"language-php": "0.18.0",
"language-property-list": "0.7.0",
"language-python": "0.21.0",
"language-python": "0.23.0",
"language-ruby": "0.41.0",
"language-ruby-on-rails": "0.18.0",
"language-sass": "0.24.0",
"language-shellscript": "0.8.0",
"language-sass": "0.25.0",
"language-shellscript": "0.10.0",
"language-source": "0.8.0",
"language-sql": "0.11.0",
"language-text": "0.6.0",
+2 -1
Ver Arquivo
@@ -1,6 +1,7 @@
Package: <%= name %>
Version: <%= version %>
Depends: python (>= 2.6), libc6
Depends: gconf2, gconf-service, libgtk2.0-0, libudev0 | libudev1, libgcrypt11, libnotify4, libxtst6, libnss3, python, gvfs-bin, xdg-utils
Suggests: libgnome-keyring0, gir1.2-gnomekeyring-1.0
Section: <%= section %>
Priority: optional
Architecture: <%= arch %>
-3
Ver Arquivo
@@ -4,9 +4,6 @@ Release: 0.1%{?dist}
Summary: Atom is a hackable text editor for the 21st century
License: MIT
URL: https://atom.io/
BuildConflicts: gyp
BuildRequires: make, gcc, gcc-c++, glibc-devel, git-core, libgnome-keyring-devel
Requires: libgnome-keyring
AutoReqProv: no # Avoid libchromiumcontent.so missing dependency
%description
+1 -1
Ver Arquivo
@@ -6,7 +6,7 @@ ThemeManager = require '../src/theme-manager'
describe "the `atom` global", ->
beforeEach ->
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
describe 'window sizing methods', ->
describe '::getPosition and ::setPosition', ->
+9 -1
Ver Arquivo
@@ -1,4 +1,5 @@
CommandRegistry = require '../src/command-registry'
_ = require 'underscore-plus'
describe "CommandRegistry", ->
[registry, parent, child, grandchild] = []
@@ -154,8 +155,15 @@ describe "CommandRegistry", ->
registry.add '.grandchild', 'namespace:command-3', ->
registry.add '.grandchild.no-match', 'namespace:command-4', ->
expect(registry.findCommands(target: grandchild)[0..2]).toEqual [
registry.add grandchild, 'namespace:inline-command-1', ->
registry.add child, 'namespace:inline-command-2', ->
commands = registry.findCommands(target: grandchild)
nonJqueryCommands = _.reject commands, (cmd) -> cmd.jQuery
expect(nonJqueryCommands).toEqual [
{name: 'namespace:inline-command-1', displayName: 'Namespace: Inline Command 1'}
{name: 'namespace:command-3', displayName: 'Namespace: Command 3'}
{name: 'namespace:inline-command-2', displayName: 'Namespace: Inline Command 2'}
{name: 'namespace:command-2', displayName: 'Namespace: Command 2'}
{name: 'namespace:command-1', displayName: 'Namespace: Command 1'}
]
@@ -0,0 +1 @@
a { color: red }
@@ -0,0 +1,4 @@
{
"theme": "syntax",
"stylesheets": ["editor.less"]
}
+83 -38
Ver Arquivo
@@ -3,7 +3,7 @@ Package = require '../src/package'
describe "PackageManager", ->
beforeEach ->
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
describe "::loadPackage(name)", ->
it "continues if the package has an invalid package.json", ->
@@ -48,9 +48,10 @@ describe "PackageManager", ->
describe "when called multiple times", ->
it "it only calls activate on the package once", ->
spyOn(Package.prototype, 'activateNow').andCallThrough()
atom.packages.activatePackage('package-with-index')
atom.packages.activatePackage('package-with-index')
waitsForPromise ->
atom.packages.activatePackage('package-with-index')
waitsForPromise ->
atom.packages.activatePackage('package-with-index')
waitsForPromise ->
atom.packages.activatePackage('package-with-index')
@@ -182,8 +183,10 @@ describe "PackageManager", ->
pack.mainModule.someNumber = 77
atom.packages.deactivatePackage("package-with-serialization")
spyOn(pack.mainModule, 'activate').andCallThrough()
atom.packages.activatePackage("package-with-serialization")
expect(pack.mainModule.activate).toHaveBeenCalledWith({someNumber: 77})
waitsForPromise ->
atom.packages.activatePackage("package-with-serialization")
runs ->
expect(pack.mainModule.activate).toHaveBeenCalledWith({someNumber: 77})
it "logs warning instead of throwing an exception if the package fails to load", ->
atom.config.set("core.disabledPackages", [])
@@ -202,11 +205,13 @@ describe "PackageManager", ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
atom.packages.activatePackage("package-with-keymaps")
waitsForPromise ->
atom.packages.activatePackage("package-with-keymaps")
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
runs ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
describe "when the metadata contains a 'keymaps' manifest", ->
it "loads only the keymaps specified by the manifest, in the specified order", ->
@@ -215,11 +220,13 @@ describe "PackageManager", ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0
atom.packages.activatePackage("package-with-keymaps-manifest")
waitsForPromise ->
atom.packages.activatePackage("package-with-keymaps-manifest")
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0
runs ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0
describe "menu loading", ->
beforeEach ->
@@ -232,14 +239,16 @@ describe "PackageManager", ->
expect(atom.contextMenu.templateForElement(element)).toEqual []
atom.packages.activatePackage("package-with-menus")
waitsForPromise ->
atom.packages.activatePackage("package-with-menus")
expect(atom.menu.template.length).toBe 2
expect(atom.menu.template[0].label).toBe "Second to Last"
expect(atom.menu.template[1].label).toBe "Last"
expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 1"
expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 2"
expect(atom.contextMenu.templateForElement(element)[2].label).toBe "Menu item 3"
runs ->
expect(atom.menu.template.length).toBe 2
expect(atom.menu.template[0].label).toBe "Second to Last"
expect(atom.menu.template[1].label).toBe "Last"
expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 1"
expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 2"
expect(atom.contextMenu.templateForElement(element)[2].label).toBe "Menu item 3"
describe "when the metadata contains a 'menus' manifest", ->
it "loads only the menus specified by the manifest, in the specified order", ->
@@ -247,13 +256,15 @@ describe "PackageManager", ->
expect(atom.contextMenu.templateForElement(element)).toEqual []
atom.packages.activatePackage("package-with-menus-manifest")
waitsForPromise ->
atom.packages.activatePackage("package-with-menus-manifest")
expect(atom.menu.template[0].label).toBe "Second to Last"
expect(atom.menu.template[1].label).toBe "Last"
expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 2"
expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 1"
expect(atom.contextMenu.templateForElement(element)[2]).toBeUndefined()
runs ->
expect(atom.menu.template[0].label).toBe "Second to Last"
expect(atom.menu.template[1].label).toBe "Last"
expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 2"
expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 1"
expect(atom.contextMenu.templateForElement(element)[2]).toBeUndefined()
describe "stylesheet loading", ->
describe "when the metadata contains a 'stylesheets' manifest", ->
@@ -270,33 +281,67 @@ describe "PackageManager", ->
expect(atom.themes.stylesheetElementForId(two)).toBeNull()
expect(atom.themes.stylesheetElementForId(three)).toBeNull()
atom.packages.activatePackage("package-with-stylesheets-manifest")
waitsForPromise ->
atom.packages.activatePackage("package-with-stylesheets-manifest")
expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(three)).toBeNull()
expect($('#jasmine-content').css('font-size')).toBe '1px'
runs ->
expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(three)).toBeNull()
expect($('#jasmine-content').css('font-size')).toBe '1px'
describe "when the metadata does not contain a 'stylesheets' manifest", ->
it "loads all stylesheets from the stylesheets directory", ->
one = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/1.css")
two = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/2.less")
three = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/3.css")
three = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/3.test-context.css")
four = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/4.css")
one = atom.themes.stringToId(one)
two = atom.themes.stringToId(two)
three = atom.themes.stringToId(three)
four = atom.themes.stringToId(four)
expect(atom.themes.stylesheetElementForId(one)).toBeNull()
expect(atom.themes.stylesheetElementForId(two)).toBeNull()
expect(atom.themes.stylesheetElementForId(three)).toBeNull()
expect(atom.themes.stylesheetElementForId(four)).toBeNull()
waitsForPromise ->
atom.packages.activatePackage("package-with-stylesheets")
runs ->
expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(three)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(four)).not.toBeNull()
expect($('#jasmine-content').css('font-size')).toBe '3px'
it "assigns the stylesheet's context based on the filename", ->
waitsForPromise ->
atom.packages.activatePackage("package-with-stylesheets")
expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(three)).not.toBeNull()
expect($('#jasmine-content').css('font-size')).toBe '3px'
runs ->
count = 0
for styleElement in atom.styles.getStyleElements()
if styleElement.sourcePath.match /1.css/
expect(styleElement.context).toBe undefined
count++
if styleElement.sourcePath.match /2.less/
expect(styleElement.context).toBe undefined
count++
if styleElement.sourcePath.match /3.test-context.css/
expect(styleElement.context).toBe 'test-context'
count++
if styleElement.sourcePath.match /4.css/
expect(styleElement.context).toBe undefined
count++
expect(count).toBe 4
describe "grammar loading", ->
it "loads the package's grammars", ->
+1 -1
Ver Arquivo
@@ -92,7 +92,7 @@ describe "Package", ->
it "reloads without readding to the stylesheets list", ->
expect(theme.getStylesheetPaths().length).toBe 3
theme.reloadStylesheet(theme.getStylesheetPaths()[0])
theme.reloadStylesheets()
expect(theme.getStylesheetPaths().length).toBe 3
describe "events", ->
+7
Ver Arquivo
@@ -33,6 +33,13 @@ describe "PaneContainer", ->
[pane1B, pane2B, pane3B] = containerB.getPanes()
expect(containerB.getActivePane()).toBe pane3B
it "makes the first pane active if no pane exists for the activePaneId", ->
pane3A.activate()
state = containerA.serialize()
state.activePaneId = -22
containerB = atom.deserializers.deserialize(state)
expect(containerB.getActivePane()).toBe containerB.getPanes()[0]
it "does not allow the root pane to be destroyed", ->
container = new PaneContainer
container.getRoot().destroy()
+6 -6
Ver Arquivo
@@ -19,7 +19,7 @@ describe "PaneContainerView", ->
save: -> @saved = true
isEqual: (other) -> @name is other?.name
container = atom.workspace.getView(atom.workspace.paneContainer).__spacePenView
container = atom.views.getView(atom.workspace.paneContainer).__spacePenView
pane1 = container.getRoot()
pane1.activateItem(new TestView('1'))
pane2 = pane1.splitRight(new TestView('2'))
@@ -73,7 +73,7 @@ describe "PaneContainerView", ->
describe "serialization", ->
it "can be serialized and deserialized, and correctly adjusts dimensions of deserialized panes after attach", ->
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
newContainer = atom.views.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('atom-pane-axis.horizontal > :contains(1)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > :contains(2)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > :contains(3)')).toExist()
@@ -89,14 +89,14 @@ describe "PaneContainerView", ->
describe "if the 'core.destroyEmptyPanes' config option is false (the default)", ->
it "leaves the empty panes intact", ->
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
newContainer = atom.views.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('atom-pane-axis.horizontal > :contains(1)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > atom-pane').length).toBe 2
describe "if the 'core.destroyEmptyPanes' config option is true", ->
it "removes empty panes on deserialization", ->
atom.config.set('core.destroyEmptyPanes', true)
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
newContainer = atom.views.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('atom-pane-axis.horizontal, atom-pane-axis.vertical')).not.toExist()
expect(newContainer.find('> :contains(1)')).toExist()
@@ -109,7 +109,7 @@ describe "PaneContainerView", ->
item2b = new TestView('2b')
item3a = new TestView('3a')
container = atom.workspace.getView(new PaneContainer).__spacePenView
container = atom.views.getView(new PaneContainer).__spacePenView
pane1 = container.getRoot()
pane1.activateItem(item1a)
container.attachToDom()
@@ -259,7 +259,7 @@ describe "PaneContainerView", ->
# |7|8|9|
# -------
container = atom.workspace.getView(new PaneContainer).__spacePenView
container = atom.views.getView(new PaneContainer).__spacePenView
pane1 = container.getRoot()
pane1.activateItem(new TestView('1'))
pane4 = pane1.splitDown(new TestView('4'))
+49
Ver Arquivo
@@ -146,6 +146,24 @@ describe "Pane", ->
pane.activateNextItem()
expect(pane.getActiveItem()).toBe item1
describe "::moveItemRight() and ::moveItemLeft()", ->
it "moves the active item to the right and left, without looping around at either end", ->
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
[item1, item2, item3] = pane.getItems()
pane.activateItemAtIndex(0)
expect(pane.getActiveItem()).toBe item1
pane.moveItemLeft()
expect(pane.getItems()).toEqual [item1, item2, item3]
pane.moveItemRight()
expect(pane.getItems()).toEqual [item2, item1, item3]
pane.moveItemLeft()
expect(pane.getItems()).toEqual [item1, item2, item3]
pane.activateItemAtIndex(2)
expect(pane.getActiveItem()).toBe item3
pane.moveItemRight()
expect(pane.getItems()).toEqual [item1, item2, item3]
describe "::activateItemAtIndex(index)", ->
it "activates the item at the given index", ->
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
@@ -565,6 +583,37 @@ describe "Pane", ->
expect(pane1.isActive()).toBe false
expect(pane2.isActive()).toBe true
describe "::close()", ->
it "prompts to save unsaved items before destroying the pane", ->
pane = new Pane(items: [new Item("A"), new Item("B")])
[item1, item2] = pane.getItems()
item1.shouldPromptToSave = -> true
item1.getUri = -> "/test/path"
item1.save = jasmine.createSpy("save")
spyOn(atom, 'confirm').andReturn(0)
pane.close()
expect(atom.confirm).toHaveBeenCalled()
expect(item1.save).toHaveBeenCalled()
expect(pane.isDestroyed()).toBe true
it "does not destroy the pane if cancel is called", ->
pane = new Pane(items: [new Item("A"), new Item("B")])
[item1, item2] = pane.getItems()
item1.shouldPromptToSave = -> true
item1.getUri = -> "/test/path"
item1.save = jasmine.createSpy("save")
spyOn(atom, 'confirm').andReturn(1)
pane.close()
expect(atom.confirm).toHaveBeenCalled()
expect(item1.save).not.toHaveBeenCalled()
expect(pane.isDestroyed()).toBe false
describe "::destroy()", ->
[container, pane1, pane2] = []
+6 -3
Ver Arquivo
@@ -24,7 +24,7 @@ describe "PaneView", ->
beforeEach ->
deserializerDisposable = atom.deserializers.add(TestView)
container = atom.workspace.getView(new PaneContainer).__spacePenView
container = atom.views.getView(new PaneContainer).__spacePenView
containerModel = container.model
view1 = new TestView(id: 'view-1', text: 'View 1')
view2 = new TestView(id: 'view-2', text: 'View 2')
@@ -144,12 +144,15 @@ describe "PaneView", ->
describe "when an item is moved to another pane", ->
it "detaches the item's view rather than removing it", ->
container.attachToDom()
expect(view1.is(':visible')).toBe true
paneModel2 = paneModel.splitRight()
view1.data('preservative', 1234)
paneModel.moveItemToPane(view1, paneModel2, 1)
expect(view1.data('preservative')).toBe 1234
paneModel2.activateItemAtIndex(1)
expect(view1.data('preservative')).toBe 1234
expect(view1.is(':visible')).toBe true
describe "when the title of the active item changes", ->
describe 'when there is no onDidChangeTitle method', ->
@@ -311,13 +314,13 @@ describe "PaneView", ->
container.attachToDom()
pane.focus()
container2 = atom.workspace.getView(container.model.testSerialization()).__spacePenView
container2 = atom.views.getView(container.model.testSerialization()).__spacePenView
pane2 = container2.getRoot()
container2.attachToDom()
expect(pane2).toMatchSelector(':has(:focus)')
$(document.activeElement).blur()
container3 = atom.workspace.getView(container.model.testSerialization()).__spacePenView
container3 = atom.views.getView(container.model.testSerialization()).__spacePenView
pane3 = container3.getRoot()
container3.attachToDom()
expect(pane3).not.toMatchSelector(':has(:focus)')
+66 -11
Ver Arquivo
@@ -43,21 +43,76 @@ describe "PanelContainerElement", ->
expect(element.parentNode).not.toBe jasmineContent
describe "adding and removing panels", ->
it "adds atom-panel elements when a new panel is added to the container; removes them when the panels are destroyed", ->
expect(element.childNodes.length).toBe 0
describe "when the container is at the left location", ->
it "adds atom-panel elements when a new panel is added to the container; removes them when the panels are destroyed", ->
expect(element.childNodes.length).toBe 0
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem(), location: 'left'})
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0].getAttribute('location')).toBe 'left'
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
expect(panel1.getView().style.display).not.toBe 'none'
expect(panel2.getView().style.display).not.toBe 'none'
panel1.destroy()
expect(element.childNodes.length).toBe 1
panel2.destroy()
expect(element.childNodes.length).toBe 0
describe "when the container is at the bottom location", ->
beforeEach ->
container = new PanelContainer({viewRegistry, location: 'bottom'})
element = container.getView()
jasmineContent.appendChild(element)
it "adds atom-panel elements when a new panel is added to the container; removes them when the panels are destroyed", ->
expect(element.childNodes.length).toBe 0
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem(), className: 'one'})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0].getAttribute('location')).toBe 'bottom'
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
expect(panel1.getView()).toHaveClass 'one'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem(), className: 'two'})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
expect(panel2.getView()).toHaveClass 'two'
panel1.destroy()
expect(element.childNodes.length).toBe 1
panel2.destroy()
expect(element.childNodes.length).toBe 0
describe "when the container is modal", ->
beforeEach ->
container = new PanelContainer({viewRegistry, location: 'modal'})
element = container.getView()
jasmineContent.appendChild(element)
it "allows only one panel to be visible at a time", ->
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
expect(panel1.getView().style.display).not.toBe 'none'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem(), location: 'left'})
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
panel1.destroy()
expect(element.childNodes.length).toBe 1
expect(panel1.getView().style.display).toBe 'none'
expect(panel2.getView().style.display).not.toBe 'none'
panel2.destroy()
expect(element.childNodes.length).toBe 0
panel1.show()
expect(panel1.getView().style.display).not.toBe 'none'
expect(panel2.getView().style.display).toBe 'none'
+9
Ver Arquivo
@@ -54,3 +54,12 @@ describe "PanelElement", ->
panel.show()
expect(element.style.display).not.toBe 'none'
describe "when a class name is specified", ->
it 'initially renders panel created with visibile: false', ->
panel = new Panel({viewRegistry, className: 'some classes', item: new TestPanelItem})
element = panel.getView()
jasmineContent.appendChild(element)
expect(element).toHaveClass 'some'
expect(element).toHaveClass 'classes'
+1 -1
Ver Arquivo
@@ -184,7 +184,7 @@ describe "SelectListView", ->
describe "when the mini editor loses focus", ->
it "triggers the cancelled hook and detaches the select list", ->
spyOn(selectList, 'detach')
filterEditorView.hiddenInput.trigger 'focusout'
filterEditorView.trigger 'blur'
expect(selectList.cancelled).toHaveBeenCalled()
expect(selectList.detach).toHaveBeenCalled()
+4 -7
Ver Arquivo
@@ -106,6 +106,7 @@ beforeEach ->
config.set "editor.autoIndent", false
config.set "core.disabledPackages", ["package-that-throws-an-exception",
"package-with-broken-package-json", "package-with-broken-keymap"]
config.set "editor.useShadowDOM", true
config.load.reset()
config.save.reset()
@@ -219,7 +220,7 @@ addCustomMatchers = (spec) ->
@message = -> return "Expected element '" + @actual + "' or its descendants" + notText + " to have focus."
element = @actual
element = element.get(0) if element.jquery
element.webkitMatchesSelector(":focus") or element.querySelector(":focus")
element is document.activeElement or element.contains(document.activeElement)
toShow: ->
notText = if @isNot then " not" else ""
@@ -338,12 +339,8 @@ window.setEditorWidthInChars = (editorView, widthInChars, charWidth=editorView.c
$(window).trigger 'resize' # update width of editor view's on-screen lines
window.setEditorHeightInLines = (editorView, heightInLines, lineHeight=editorView.lineHeight) ->
if editorView.hasClass('react')
editorView.height(editorView.getEditor().getLineHeightInPixels() * heightInLines)
editorView.component?.measureHeightAndWidth()
else
editorView.height(lineHeight * heightInLines + editorView.renderedLines.position().top)
$(window).trigger 'resize' # update editor view's on-screen lines
editorView.height(editorView.getEditor().getLineHeightInPixels() * heightInLines)
editorView.component?.measureHeightAndWidth()
$.fn.resultOfTrigger = (type) ->
event = $.Event(type)
+22
Ver Arquivo
@@ -52,3 +52,25 @@ describe "StylesElement", ->
expect(element.children.length).toBe initialChildCount + 1
expect(element.children[initialChildCount].textContent).toBe "a {color: blue;}"
expect(updatedStyleElements).toEqual [element.children[initialChildCount]]
it "only includes style elements matching the 'context' attribute", ->
initialChildCount = element.children.length
atom.styles.addStyleSheet("a {color: red;}", context: 'test-context')
atom.styles.addStyleSheet("a {color: green;}")
expect(element.children.length).toBe initialChildCount + 2
expect(element.children[initialChildCount].textContent).toBe "a {color: red;}"
expect(element.children[initialChildCount + 1].textContent).toBe "a {color: green;}"
element.setAttribute('context', 'test-context')
expect(element.children.length).toBe 1
expect(element.children[0].textContent).toBe "a {color: red;}"
atom.styles.addStyleSheet("a {color: blue;}", context: 'test-context')
atom.styles.addStyleSheet("a {color: yellow;}")
expect(element.children.length).toBe 2
expect(element.children[0].textContent).toBe "a {color: red;}"
expect(element.children[1].textContent).toBe "a {color: blue;}"
+46 -6
Ver Arquivo
@@ -721,11 +721,11 @@ describe "TextEditorComponent", ->
editor.setCursorScreenPosition([0, 16])
nextAnimationFrame()
atom.themes.applyStylesheet 'test', """
atom.styles.addStyleSheet """
.function.js {
font-weight: bold;
}
"""
""", context: 'atom-text-editor'
nextAnimationFrame() # update based on new measurements
cursor = componentNode.querySelector('.cursor')
@@ -1131,6 +1131,13 @@ describe "TextEditorComponent", ->
regions = componentNode.querySelectorAll('.test-highlight .region')
expect(regions.length).toBe 2
it "renders classes on the regions directly if 'deprecatedRegionClass' option is defined", ->
decoration = editor.decorateMarker(marker, type: 'highlight', class: 'test-highlight', deprecatedRegionClass: 'test-highlight-region')
nextAnimationFrame()
regions = componentNode.querySelectorAll('.test-highlight .region.test-highlight-region')
expect(regions.length).toBe 2
describe "when flashing a decoration via Decoration::flash()", ->
highlightNode = null
beforeEach ->
@@ -1537,8 +1544,9 @@ describe "TextEditorComponent", ->
it "transfers focus to the hidden input", ->
expect(document.activeElement).toBe document.body
componentNode.focus()
expect(document.activeElement).toBe inputNode
wrapperNode.focus()
expect(document.activeElement).toBe wrapperNode
expect(wrapperNode.shadowRoot.activeElement).toBe inputNode
it "adds the 'is-focused' class to the editor when the hidden input is focused", ->
expect(document.activeElement).toBe document.body
@@ -1667,12 +1675,13 @@ describe "TextEditorComponent", ->
component.measureHeightAndWidth()
nextAnimationFrame()
atom.themes.applyStylesheet "test", """
atom.styles.addStyleSheet """
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
"""
""", context: 'atom-text-editor'
nextAnimationFrame()
scrollbarCornerNode = componentNode.querySelector('.scrollbar-corner')
@@ -1922,6 +1931,31 @@ describe "TextEditorComponent", ->
expect(nextAnimationFrame).toBe noAnimationFrame
expect(editor.lineTextForBufferRow(0)).toBe 'var quicksort = function () {'
it "groups events that occur close together in time into single undo entries", ->
currentTime = 0
spyOn(Date, 'now').andCallFake -> currentTime
atom.config.set('editor.undoGroupingInterval', 100)
editor.setText("")
componentNode.dispatchEvent(buildTextInputEvent(data: 'x', target: inputNode))
currentTime += 99
componentNode.dispatchEvent(buildTextInputEvent(data: 'y', target: inputNode))
currentTime += 99
componentNode.dispatchEvent(new CustomEvent('editor:duplicate-lines', bubbles: true, cancelable: true))
currentTime += 100
componentNode.dispatchEvent(new CustomEvent('editor:duplicate-lines', bubbles: true, cancelable: true))
expect(editor.getText()).toBe "xy\nxy\nxy"
componentNode.dispatchEvent(new CustomEvent('core:undo', bubbles: true, cancelable: true))
expect(editor.getText()).toBe "xy\nxy"
componentNode.dispatchEvent(new CustomEvent('core:undo', bubbles: true, cancelable: true))
expect(editor.getText()).toBe ""
describe "when IME composition is used to insert international characters", ->
inputNode = null
@@ -2286,6 +2320,12 @@ describe "TextEditorComponent", ->
editor.setGrammar(atom.syntax.nullGrammar)
expect(wrapperNode.dataset.grammar).toBe 'text plain null-grammar'
describe "encoding data attributes", ->
it "adds and updates the encoding data attribute based on the current encoding", ->
expect(wrapperNode.dataset.encoding).toBe 'utf8'
editor.setEncoding('utf16le')
expect(wrapperNode.dataset.encoding).toBe 'utf16le'
describe "detaching and reattaching the editor (regression)", ->
it "does not throw an exception", ->
wrapperView.detach()
+88 -12
Ver Arquivo
@@ -19,18 +19,94 @@ describe "TextEditorElement", ->
element = jasmineContent.firstChild
expect(element.getModel().getPlaceholderText()).toBe 'testing'
describe "::focus()", ->
it "transfers focus to the hidden text area and does not emit 'focusout' or 'blur' events", ->
element = new TextEditorElement
describe "focus and blur handling", ->
describe "when the editor.useShadowDOM config option is true", ->
it "proxies focus/blur events to/from the hidden input inside the shadow root", ->
atom.config.set('editor.useShadowDOM', true)
element = new TextEditorElement
jasmineContent.appendChild(element)
blurCalled = false
element.addEventListener 'blur', -> blurCalled = true
element.focus()
expect(blurCalled).toBe false
expect(element.hasFocus()).toBe true
expect(document.activeElement).toBe element
expect(element.shadowRoot.activeElement).toBe element.shadowRoot.querySelector('input')
document.body.focus()
expect(blurCalled).toBe true
describe "when the editor.useShadowDOM config option is false", ->
it "proxies focus/blur events to/from the hidden input", ->
atom.config.set('editor.useShadowDOM', false)
element = new TextEditorElement
jasmineContent.appendChild(element)
blurCalled = false
element.addEventListener 'blur', -> blurCalled = true
element.focus()
expect(blurCalled).toBe false
expect(element.hasFocus()).toBe true
expect(document.activeElement).toBe element.querySelector('input')
document.body.focus()
expect(blurCalled).toBe true
describe "style transfer", ->
beforeEach ->
waitsForPromise -> atom.themes.activateThemes()
afterEach ->
atom.themes.deactivateThemes()
ffit "transfers the foreground and background colors into the shadow DOM", ->
runs ->
element = new TextEditorElement()
jasmineContent.appendChild(element)
initialBackgroundColor = getComputedStyle(element.shadowRoot.querySelector('.editor')).backgroundColor
atom.styles.addStyleSheet """
atom-text-editor { background: red; }
"""
newBackgroundColor = getComputedStyle(element.shadowRoot.querySelector('.editor')).backgroundColor
expect(newBackgroundColor).not.toBe initialBackgroundColor
describe "when the themes finish loading with the shadow DOM disabled (regressios)", ->
[themeReloadCallback, initialThemeLoadComplete, element] = []
beforeEach ->
themeReloadCallback = null
initialThemeLoadComplete = false
spyOn(atom.themes, 'isInitialLoadComplete').andCallFake ->
initialThemeLoadComplete
spyOn(atom.themes, 'onDidReloadAll').andCallFake (fn) ->
themeReloadCallback = fn
atom.config.set("editor.useShadowDOM", false)
element = new TextEditorElement()
element.style.height = '200px'
element.getModel().setText [0..20].join("\n")
it "re-renders the scrollbar", ->
jasmineContent.appendChild(element)
focusoutCalled = false
element.addEventListener 'focusout', -> focusoutCalled = true
blurCalled = false
element.addEventListener 'blur', -> blurCalled = true
atom.styles.addStyleSheet """
::-webkit-scrollbar {
width: 8px;
}
"""
element.focus()
expect(focusoutCalled).toBe false
expect(blurCalled).toBe false
expect(element.hasFocus()).toBe true
expect(element.querySelector('input')).toBe document.activeElement
initialThemeLoadComplete = true
themeReloadCallback()
verticalScrollbarNode = element.querySelector(".vertical-scrollbar")
scrollbarWidth = verticalScrollbarNode.offsetWidth - verticalScrollbarNode.clientWidth
expect(scrollbarWidth).toEqual(8)
+76 -1
Ver Arquivo
@@ -98,12 +98,13 @@ describe "TextEditor", ->
expect(editor2.isFoldedAtBufferRow(4)).not.toBe editor.isFoldedAtBufferRow(4)
describe "config defaults", ->
it "uses the `editor.tabLength`, `editor.softWrap`, and `editor.softTabs` config values", ->
it "uses the `editor.tabLength`, `editor.softWrap`, and `editor.softTabs`, and `core.fileEncoding` config values", ->
editor1 = null
editor2 = null
atom.config.set('editor.tabLength', 4)
atom.config.set('editor.softWrap', true)
atom.config.set('editor.softTabs', false)
atom.config.set('core.fileEncoding', 'utf16le')
waitsForPromise ->
atom.workspace.open('a').then (o) -> editor1 = o
@@ -112,10 +113,12 @@ describe "TextEditor", ->
expect(editor1.getTabLength()).toBe 4
expect(editor1.isSoftWrapped()).toBe true
expect(editor1.getSoftTabs()).toBe false
expect(editor1.getEncoding()).toBe 'utf16le'
atom.config.set('editor.tabLength', 8)
atom.config.set('editor.softWrap', false)
atom.config.set('editor.softTabs', true)
atom.config.set('core.fileEncoding', 'macroman')
waitsForPromise ->
atom.workspace.open('b').then (o) -> editor2 = o
@@ -124,6 +127,7 @@ describe "TextEditor", ->
expect(editor2.getTabLength()).toBe 8
expect(editor2.isSoftWrapped()).toBe false
expect(editor2.getSoftTabs()).toBe true
expect(editor2.getEncoding()).toBe 'macroman'
describe "title", ->
describe ".getTitle()", ->
@@ -157,6 +161,19 @@ describe "TextEditor", ->
expect(observed).toEqual [__filename, undefined]
describe "encoding", ->
it "notifies ::onDidChangeEncoding observers when the editor encoding changes", ->
observed = []
editor.onDidChangeEncoding (encoding) -> observed.push(encoding)
editor.setEncoding('utf16le')
editor.setEncoding('utf16le')
editor.setEncoding('utf16be')
editor.setEncoding()
editor.setEncoding()
expect(observed).toEqual ['utf16le', 'utf16be', 'utf8']
describe "cursor", ->
describe ".getLastCursor()", ->
it "returns the most recently created cursor", ->
@@ -1145,6 +1162,21 @@ describe "TextEditor", ->
editor.selectLinesContainingCursors()
expect(editor.getSelectedBufferRange()).toEqual [[0,0], [2,0]]
it "autoscrolls to the selection", ->
editor.manageScrollPosition = true
editor.setLineHeightInPixels(10)
editor.setDefaultCharWidth(10)
editor.setHeight(50)
editor.setWidth(50)
editor.setHorizontalScrollbarHeight(0)
editor.setCursorScreenPosition([5, 6])
editor.scrollToTop()
expect(editor.getScrollTop()).toBe 0
editor.selectLinesContainingCursors()
expect(editor.getScrollBottom()).toBe (7 + editor.getVerticalScrollMargin()) * 10
describe ".selectToBeginningOfWord()", ->
it "selects text from cusor position to beginning of word", ->
editor.setCursorScreenPosition [0,13]
@@ -1792,6 +1824,16 @@ describe "TextEditor", ->
expect(willInsertSpy).toHaveBeenCalled()
expect(didInsertSpy).not.toHaveBeenCalled()
describe "when the undo option is set to 'skip'", ->
beforeEach ->
editor.setSelectedBufferRange([[1, 2], [1, 2]])
it "does not undo the skipped operation", ->
range = editor.insertText('x')
range = editor.insertText('y', undo: 'skip')
editor.undo()
expect(buffer.lineForRow(1)).toBe ' yvar sort = function(items) {'
describe ".insertNewline()", ->
describe "when there is a single cursor", ->
describe "when the cursor is at the beginning of a line", ->
@@ -2446,6 +2488,22 @@ describe "TextEditor", ->
expect(clipboard.readText()).toBe 'quicksort\nsort'
describe "when no text is selected", ->
beforeEach ->
editor.setSelectedBufferRanges([[1, 0], [1, 0]])
editor.addCursorAtBufferPosition([5, 0])
it "cuts the lines on which there are cursors", ->
editor.cutSelectedText()
expect(buffer.getLineCount()).toBe(11)
expect(buffer.lineForRow(1)).toBe(" if (items.length <= 1) return items;")
expect(buffer.lineForRow(4)).toBe(" current < pivot ? left.push(current) : right.push(current);")
expect(atom.clipboard.readWithMetadata().metadata.selections).toEqual([
"var quicksort = function () {\n"
" current = items.shift();\n"
])
describe ".cutToEndOfLine()", ->
describe "when soft wrap is on", ->
it "cuts up to the end of the line", ->
@@ -2490,6 +2548,18 @@ describe "TextEditor", ->
'items'
])
describe "when no text is selected", ->
beforeEach ->
editor.setSelectedBufferRanges([[1, 0], [1, 0]])
editor.addCursorAtBufferPosition([5, 0])
it "copies the lines on which there are cursors", ->
editor.copySelectedText()
expect(atom.clipboard.readWithMetadata().metadata.selections).toEqual([
"var quicksort = function () {\n"
" current = items.shift();\n"
])
describe ".pasteText()", ->
it "pastes text into the buffer", ->
atom.clipboard.write('first')
@@ -3087,6 +3157,11 @@ describe "TextEditor", ->
expect(editor.getTabLength()).toBe 6
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 6
changeHandler = jasmine.createSpy('changeHandler')
editor.onDidChange(changeHandler)
editor.setTabLength(6)
expect(changeHandler).not.toHaveBeenCalled()
it 'retokenizes when the editor.tabLength setting is updated', ->
expect(editor.getTabLength()).toBe 2
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 2
+28 -31
Ver Arquivo
@@ -85,16 +85,7 @@ describe "ThemeManager", ->
runs ->
reloadHandler.reset()
expect($('style.theme')).toHaveLength 0
atom.config.set('core.themes', ['atom-dark-syntax'])
waitsFor ->
reloadHandler.callCount == 1
runs ->
reloadHandler.reset()
expect($('style[group=theme]')).toHaveLength 1
expect($('style[group=theme]:eq(0)').attr('source-path')).toMatch /atom-dark-syntax/
atom.config.set('core.themes', ['atom-light-syntax', 'atom-dark-syntax'])
atom.config.set('core.themes', ['atom-dark-ui'])
waitsFor ->
reloadHandler.callCount == 1
@@ -102,8 +93,17 @@ describe "ThemeManager", ->
runs ->
reloadHandler.reset()
expect($('style[group=theme]')).toHaveLength 2
expect($('style[group=theme]:eq(0)').attr('source-path')).toMatch /atom-dark-syntax/
expect($('style[group=theme]:eq(1)').attr('source-path')).toMatch /atom-light-syntax/
expect($('style[group=theme]:eq(0)').attr('source-path')).toMatch /atom-dark-ui/
atom.config.set('core.themes', ['atom-light-ui', 'atom-dark-ui'])
waitsFor ->
reloadHandler.callCount == 1
runs ->
reloadHandler.reset()
expect($('style[group=theme]')).toHaveLength 2
expect($('style[group=theme]:eq(0)').attr('source-path')).toMatch /atom-dark-ui/
expect($('style[group=theme]:eq(1)').attr('source-path')).toMatch /atom-light-ui/
atom.config.set('core.themes', [])
waitsFor ->
@@ -111,7 +111,7 @@ describe "ThemeManager", ->
runs ->
reloadHandler.reset()
expect($('style[group=theme]')).toHaveLength 0
expect($('style[group=theme]')).toHaveLength 2
# atom-dark-ui has an directory path, the syntax one doesn't
atom.config.set('core.themes', ['theme-with-index-less', 'atom-dark-ui'])
@@ -208,7 +208,7 @@ describe "ThemeManager", ->
describe "base stylesheet loading", ->
beforeEach ->
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.append $('<atom-text-editor>')
atom.workspaceView.attachToDom()
@@ -217,7 +217,7 @@ describe "ThemeManager", ->
it "loads the correct values from the theme's ui-variables file", ->
themeManager.onDidReloadAll reloadHandler = jasmine.createSpy()
atom.config.set('core.themes', ['theme-with-ui-variables'])
atom.config.set('core.themes', ['theme-with-ui-variables', 'theme-with-syntax-variables'])
waitsFor ->
reloadHandler.callCount > 0
@@ -234,7 +234,7 @@ describe "ThemeManager", ->
describe "when there is a theme with incomplete variables", ->
it "loads the correct values from the fallback ui-variables", ->
themeManager.onDidReloadAll reloadHandler = jasmine.createSpy()
atom.config.set('core.themes', ['theme-with-incomplete-ui-variables'])
atom.config.set('core.themes', ['theme-with-incomplete-ui-variables', 'theme-with-syntax-variables'])
waitsFor ->
reloadHandler.callCount > 0
@@ -251,7 +251,7 @@ describe "ThemeManager", ->
expect(atom.workspaceView).toHaveClass 'theme-atom-dark-ui'
themeManager.onDidReloadAll reloadHandler = jasmine.createSpy()
atom.config.set('core.themes', ['theme-with-ui-variables'])
atom.config.set('core.themes', ['theme-with-ui-variables', 'theme-with-syntax-variables'])
waitsFor ->
reloadHandler.callCount > 0
@@ -259,7 +259,9 @@ describe "ThemeManager", ->
runs ->
# `theme-` twice as it prefixes the name with `theme-`
expect(atom.workspaceView).toHaveClass 'theme-theme-with-ui-variables'
expect(atom.workspaceView).toHaveClass 'theme-theme-with-syntax-variables'
expect(atom.workspaceView).not.toHaveClass 'theme-atom-dark-ui'
expect(atom.workspaceView).not.toHaveClass 'theme-atom-dark-syntax'
describe "when the user stylesheet changes", ->
it "reloads it", ->
@@ -308,24 +310,19 @@ describe "ThemeManager", ->
expect(stylesheetsChangedHandler).toHaveBeenCalled()
describe "when a non-existent theme is present in the config", ->
it "logs a warning but does not throw an exception (regression)", ->
reloaded = false
beforeEach ->
spyOn(console, 'warn')
atom.config.set('core.themes', ['non-existent-dark-ui', 'non-existent-dark-syntax'])
waitsForPromise ->
themeManager.activateThemes()
runs ->
disposable = themeManager.onDidReloadAll ->
disposable.dispose()
reloaded = true
spyOn(console, 'warn')
expect(-> atom.config.set('core.themes', ['atom-light-ui', 'theme-really-does-not-exist'])).not.toThrow()
waitsFor -> reloaded
runs ->
expect(console.warn.callCount).toBe 1
expect(console.warn.argsForCall[0][0].length).toBeGreaterThan 0
it 'uses the default dark UI and syntax themes and logs a warning', ->
activeThemeNames = themeManager.getActiveNames()
expect(console.warn.callCount).toBe 2
expect(activeThemeNames.length).toBe(2)
expect(activeThemeNames).toContain('atom-dark-ui')
expect(activeThemeNames).toContain('atom-dark-syntax')
describe "when in safe mode", ->
beforeEach ->
+9
Ver Arquivo
@@ -492,3 +492,12 @@ describe "Workspace", ->
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
describe '::addModalPanel(model)', ->
it 'adds a panel to the correct panel container', ->
atom.workspace.panelContainers.modal.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addModalPanel(item: new TestPanel())
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
expect(panel.getClassName()).toBe 'overlay from-top' # the default
+6 -3
Ver Arquivo
@@ -13,7 +13,7 @@ describe "WorkspaceView", ->
atom.project.setPaths([atom.project.resolve('dir')])
pathToOpen = atom.project.resolve('a')
atom.workspace = new Workspace
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.enableKeymap()
atom.workspaceView.focus()
@@ -29,7 +29,7 @@ describe "WorkspaceView", ->
atom.workspaceView.remove()
atom.project = atom.deserializers.deserialize(projectState)
atom.workspace = Workspace.deserialize(workspaceState)
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.attachToDom()
describe "when the serialized WorkspaceView has an unsaved buffer", ->
@@ -274,7 +274,7 @@ describe "WorkspaceView", ->
describe 'panel containers', ->
workspaceElement = null
beforeEach ->
workspaceElement = atom.workspace.getView(atom.workspace)
workspaceElement = atom.views.getView(atom.workspace)
it 'inserts panel container elements in the correct places in the DOM', ->
leftContainer = workspaceElement.querySelector('atom-panel-container[location="left"]')
@@ -286,3 +286,6 @@ describe "WorkspaceView", ->
bottomContainer = workspaceElement.querySelector('atom-panel-container[location="bottom"]')
expect(topContainer.nextSibling).toBe workspaceElement.paneContainer
expect(bottomContainer.previousSibling).toBe workspaceElement.paneContainer
modalContainer = workspaceElement.querySelector('atom-panel-container[location="modal"]')
expect(modalContainer.parentNode).toBe workspaceElement
+16 -1
Ver Arquivo
@@ -140,6 +140,9 @@ class Atom extends Model
# Public: A {DeserializerManager} instance
deserializers: null
# Public: A {ViewRegistry} instance
views: null
# Public: A {Workspace} instance
workspace: null
@@ -174,6 +177,7 @@ class Atom extends Model
@executeJavaScriptInDevTools('InspectorFrontendAPI.showConsole()')
@lastUncaughtError = Array::slice.call(arguments)
@emit 'uncaught-error', arguments...
@emitter.emit 'did-throw-error', arguments...
@unsubscribe()
@setBodyPlatformClass()
@@ -182,6 +186,7 @@ class Atom extends Model
Config = require './config'
KeymapManager = require './keymap-extensions'
ViewRegistry = require './view-registry'
CommandRegistry = require './command-registry'
PackageManager = require './package-manager'
Clipboard = require './clipboard'
@@ -209,6 +214,7 @@ class Atom extends Model
@keymaps = new KeymapManager({configDirPath, resourcePath})
@keymap = @keymaps # Deprecated
@commands = new CommandRegistry
@views = new ViewRegistry
@packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode})
@styles = new StyleManager
document.head.appendChild(new StylesElement)
@@ -242,6 +248,15 @@ class Atom extends Model
onDidBeep: (callback) ->
@emitter.on 'did-beep', callback
# Extended: Invoke the given callback whenever there is an unhandled error.
#
# * `callback` {Function} to be called whenever there is an unhandled error
# * `errorMessage` {String}
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidThrowError: (callback) ->
@emitter.on 'did-throw-error', callback
###
Section: Atom Details
###
@@ -597,7 +612,7 @@ class Atom extends Model
startTime = Date.now()
@workspace = Workspace.deserialize(@state.workspace) ? new Workspace
@workspaceView = @workspace.getView(@workspace).__spacePenView
@workspaceView = @views.getView(@workspace).__spacePenView
@deserializeTimings.workspace = Date.now() - startTime
@keymaps.defaultTarget = @workspaceView[0]
+3 -5
Ver Arquivo
@@ -22,14 +22,10 @@ class ApplicationMenu
# keystrokesByCommand - An Object where the keys are commands and the values
# are Arrays containing the keystroke.
update: (window, template, keystrokesByCommand) ->
return unless window is @lastFocusedWindow
@translateTemplate(template, keystrokesByCommand)
@substituteVersion(template)
@windowTemplates.set(window, template)
@setActiveTemplate(template)
@showUpdateMenuItem(global.atomApplication.autoUpdateManager.getState())
@setActiveTemplate(template) if window is @lastFocusedWindow
setActiveTemplate: (template) ->
unless _.isEqual(template, @activeTemplate)
@@ -37,6 +33,8 @@ class ApplicationMenu
@menu = Menu.buildFromTemplate(_.deepClone(template))
Menu.setApplicationMenu(@menu)
@showUpdateMenuItem(global.atomApplication.autoUpdateManager.getState())
# Register a BrowserWindow with this application menu.
addWindow: (window) ->
@lastFocusedWindow ?= window
+7 -1
Ver Arquivo
@@ -70,7 +70,7 @@ class AtomApplication
@autoUpdateManager = new AutoUpdateManager(@version)
@applicationMenu = new ApplicationMenu(@version)
@atomProtocolHandler = new AtomProtocolHandler(@resourcePath)
@atomProtocolHandler = new AtomProtocolHandler(@resourcePath, @safeMode)
@listenForArgumentsFromNewProcess()
@setupJavaScriptArguments()
@@ -155,7 +155,13 @@ class AtomApplication
atomWindow?.browserWindow.inspectElement(x, y)
@on 'application:open-documentation', -> require('shell').openExternal('https://atom.io/docs/latest/?app')
@on 'application:open-discussions', -> require('shell').openExternal('https://discuss.atom.io')
@on 'application:open-roadmap', -> require('shell').openExternal('https://atom.io/roadmap?app')
@on 'application:open-faq', -> require('shell').openExternal('https://atom.io/faq')
@on 'application:open-terms-of-use', -> require('shell').openExternal('https://atom.io/terms')
@on 'application:report-issue', -> require('shell').openExternal('https://github.com/atom/atom/issues/new')
@on 'application:search-issues', -> require('shell').openExternal('https://github.com/issues?q=+is%3Aissue+user%3Aatom')
@on 'application:install-update', -> @autoUpdateManager.install()
@on 'application:check-for-update', => @autoUpdateManager.check()
+29 -12
Ver Arquivo
@@ -5,16 +5,26 @@ protocol = require 'protocol'
# Handles requests with 'atom' protocol.
#
# It's created by {AtomApplication} upon instantiation, and is used to create a
# custom resource loader by adding the 'atom' custom protocol.
# It's created by {AtomApplication} upon instantiation and is used to create a
# custom resource loader for 'atom://' URLs.
#
# The following directories are searched in order:
# * ~/.atom/assets
# * ~/.atom/dev/packages (unless in safe mode)
# * ~/.atom/packages
# * RESOURCE_PATH/node_modules
#
module.exports =
class AtomProtocolHandler
constructor: (@resourcePath) ->
@loadPaths = [
path.join(app.getHomeDir(), '.atom', 'dev', 'packages')
path.join(app.getHomeDir(), '.atom', 'packages')
path.join(@resourcePath, 'node_modules')
]
constructor: (resourcePath, safeMode) ->
@loadPaths = []
@dotAtomDirectory = path.join(app.getHomeDir(), '.atom')
unless safeMode
@loadPaths.push(path.join(@dotAtomDirectory, 'dev', 'packages'))
@loadPaths.push(path.join(@dotAtomDirectory, 'packages'))
@loadPaths.push(path.join(resourcePath, 'node_modules'))
@registerAtomProtocol()
@@ -22,7 +32,14 @@ class AtomProtocolHandler
registerAtomProtocol: ->
protocol.registerProtocol 'atom', (request) =>
relativePath = path.normalize(request.url.substr(7))
for loadPath in @loadPaths
filePath = path.join(loadPath, relativePath)
break if fs.statSyncNoException(filePath).isFile?()
return new protocol.RequestFileJob(filePath)
if relativePath.indexOf('assets/') is 0
assetsPath = path.join(@dotAtomDirectory, relativePath)
filePath = assetsPath if fs.statSyncNoException(assetsPath).isFile?()
unless filePath
for loadPath in @loadPaths
filePath = path.join(loadPath, relativePath)
break if fs.statSyncNoException(filePath).isFile?()
new protocol.RequestFileJob(filePath)
+4
Ver Arquivo
@@ -134,6 +134,10 @@ parseCommandLine = ->
unless fs.statSyncNoException(resourcePath)
resourcePath = path.dirname(path.dirname(__dirname))
# On Yosemite the $PATH is not inherited by the "open" command, so we have to
# explicitly pass it by command line, see http://git.io/YC8_Ew.
process.env.PATH = args['path-environment'] if args['path-environment']
{resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile}
start()
+15 -17
Ver Arquivo
@@ -6,8 +6,6 @@ _ = require 'underscore-plus'
SequenceCount = 0
SpecificityCache = {}
module.exports =
# Public: Associates listener functions with commands in a
# context-sensitive way using CSS selectors. You can access a global instance of
# this class via `atom.commands`, and commands registered there will be
@@ -37,11 +35,10 @@ module.exports =
# ```coffee
# atom.commands.add 'atom-text-editor',
# 'user:insert-date': (event) ->
# editor = $(this).view().getModel()
# # soon the above above line will be:
# # editor = @getModel()
# editor = @getModel()
# editor.insertText(new Date().toLocaleString())
# ```
module.exports =
class CommandRegistry
constructor: (@rootNode) ->
@registeredCommands = {}
@@ -131,25 +128,26 @@ class CommandRegistry
# * `jQuery` Present if the command was registered with the legacy
# `$::command` method.
findCommands: ({target}) ->
commandNames = new Set
commands = []
currentTarget = target
loop
for name, listeners of @inlineListenersByCommandName
if listeners.has(currentTarget) and not commandNames.has(name)
commandNames.add(name)
commands.push({name, displayName: _.humanizeEventName(name)})
for commandName, listeners of @selectorBasedListenersByCommandName
for listener in listeners
if currentTarget.webkitMatchesSelector?(listener.selector)
commands.push
name: commandName
displayName: _.humanizeEventName(commandName)
unless commandNames.has(commandName)
commandNames.add(commandName)
commands.push
name: commandName
displayName: _.humanizeEventName(commandName)
break if currentTarget is @rootNode
currentTarget = currentTarget.parentNode
break unless currentTarget?
for name, displayName of $(target).events() when displayName
commands.push({name, displayName, jQuery: true})
for name, displayName of $(window).events() when displayName
commands.push({name, displayName, jQuery: true})
break if currentTarget is window
currentTarget = currentTarget.parentNode ? window
commands
+51
Ver Arquivo
@@ -35,6 +35,47 @@ module.exports =
destroyEmptyPanes:
type: 'boolean'
default: true
fileEncoding:
description: 'Default character set encoding to use when reading and writing files.'
type: 'string'
default: 'utf8'
enum: [
'cp437',
'eucjp',
'euckr',
'gbk',
'iso88591',
'iso885910',
'iso885913',
'iso885914',
'iso885915',
'iso885916',
'iso88592',
'iso88593',
'iso88594',
'iso88595',
'iso88596',
'iso88597',
'iso88597',
'iso88598',
'koi8r',
'koi8u',
'macroman',
'shiftjis',
'utf16be',
'utf16le',
'utf8',
'windows1250',
'windows1251',
'windows1252',
'windows1253',
'windows1254',
'windows1255',
'windows1256',
'windows1257',
'windows1258',
'windows866'
]
editor:
type: 'object'
@@ -105,10 +146,20 @@ module.exports =
scrollPastEnd:
type: 'boolean'
default: false
undoGroupingInterval:
type: 'integer'
default: 500
minimum: 0
description: 'Time interval in milliseconds within which operations will be grouped together in the undo history'
useHardwareAcceleration:
type: 'boolean'
default: true
description: 'Disabling will improve editor font rendering but reduce scrolling performance.'
useShadowDOM:
type: 'boolean'
default: false
title: 'Use Shadow DOM'
description: 'Enable to test out themes and packages with the new shadow DOM before it ships by default.'
confirmCheckoutHeadRevision:
type: 'boolean'
default: true
+2 -2
Ver Arquivo
@@ -76,8 +76,8 @@ class ContextMenuManager
# * `event` The click event that deployed the context menu.
add: (itemsBySelector) ->
# Detect deprecated file path as first argument
unless typeof itemsBySelector is 'object'
Grim.deprecate("ContextMenuManage::add has changed to take a single object as its argument. Please consult the documentation.")
if itemsBySelector? and typeof itemsBySelector isnt 'object'
Grim.deprecate("ContextMenuManager::add has changed to take a single object as its argument. Please consult the documentation.")
itemsBySelector = arguments[1]
devMode = arguments[2]?.devMode
+56 -44
Ver Arquivo
@@ -392,7 +392,7 @@ class Cursor extends Model
# Public: Moves the cursor to the next word boundary.
moveToNextWordBoundary: ->
if position = @getMoveNextWordBoundaryBufferPosition()
if position = @getNextWordBoundaryBufferPosition()
@setBufferPosition(position)
# Public: Moves the cursor to the beginning of the buffer line, skipping all
@@ -420,6 +420,61 @@ class Cursor extends Model
Section: Local Positions and Ranges
###
# Public: Returns buffer position of previous word boundary. It might be on
# the current word, or the previous word.
#
# * `options` (optional) {Object} with the following keys:
# * `wordRegex` A {RegExp} indicating what constitutes a "word"
# (default: {::wordRegExp})
getPreviousWordBoundaryBufferPosition: (options = {}) ->
currentBufferPosition = @getBufferPosition()
previousNonBlankRow = @editor.buffer.previousNonBlankRow(currentBufferPosition.row)
scanRange = [[previousNonBlankRow, 0], currentBufferPosition]
beginningOfWordPosition = null
@editor.backwardsScanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) ->
if range.start.row < currentBufferPosition.row and currentBufferPosition.column > 0
# force it to stop at the beginning of each line
beginningOfWordPosition = new Point(currentBufferPosition.row, 0)
else if range.end.isLessThan(currentBufferPosition)
beginningOfWordPosition = range.end
else
beginningOfWordPosition = range.start
if not beginningOfWordPosition?.isEqual(currentBufferPosition)
stop()
beginningOfWordPosition or currentBufferPosition
# Public: Returns buffer position of the next word boundary. It might be on
# the current word, or the previous word.
#
# * `options` (optional) {Object} with the following keys:
# * `wordRegex` A {RegExp} indicating what constitutes a "word"
# (default: {::wordRegExp})
getNextWordBoundaryBufferPosition: (options = {}) ->
currentBufferPosition = @getBufferPosition()
scanRange = [currentBufferPosition, @editor.getEofBufferPosition()]
endOfWordPosition = null
@editor.scanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) ->
if range.start.row > currentBufferPosition.row
# force it to stop at the beginning of each line
endOfWordPosition = new Point(range.start.row, 0)
else if range.start.isGreaterThan(currentBufferPosition)
endOfWordPosition = range.start
else
endOfWordPosition = range.end
if not endOfWordPosition?.isEqual(currentBufferPosition)
stop()
endOfWordPosition or currentBufferPosition
getMoveNextWordBoundaryBufferPosition: (options) ->
deprecate 'Use `::getNextWordBoundaryBufferPosition(options)` instead'
@getNextWordBoundaryBufferPosition(options)
# Public: Retrieves the buffer position of where the current word starts.
#
# * `options` (optional) An {Object} with the following keys:
@@ -452,49 +507,6 @@ class Cursor extends Model
else
currentBufferPosition
# Public: Retrieves buffer position of previous word boundary. It might be on
# the current word, or the previous word.
getPreviousWordBoundaryBufferPosition: (options = {}) ->
currentBufferPosition = @getBufferPosition()
previousNonBlankRow = @editor.buffer.previousNonBlankRow(currentBufferPosition.row)
scanRange = [[previousNonBlankRow, 0], currentBufferPosition]
beginningOfWordPosition = null
@editor.backwardsScanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) ->
if range.start.row < currentBufferPosition.row and currentBufferPosition.column > 0
# force it to stop at the beginning of each line
beginningOfWordPosition = new Point(currentBufferPosition.row, 0)
else if range.end.isLessThan(currentBufferPosition)
beginningOfWordPosition = range.end
else
beginningOfWordPosition = range.start
if not beginningOfWordPosition?.isEqual(currentBufferPosition)
stop()
beginningOfWordPosition or currentBufferPosition
# Public: Retrieves buffer position of the next word boundary. It might be on
# the current word, or the previous word.
getMoveNextWordBoundaryBufferPosition: (options = {}) ->
currentBufferPosition = @getBufferPosition()
scanRange = [currentBufferPosition, @editor.getEofBufferPosition()]
endOfWordPosition = null
@editor.scanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) ->
if range.start.row > currentBufferPosition.row
# force it to stop at the beginning of each line
endOfWordPosition = new Point(range.start.row, 0)
else if range.start.isGreaterThan(currentBufferPosition)
endOfWordPosition = range.start
else
endOfWordPosition = range.end
if not endOfWordPosition?.isEqual(currentBufferPosition)
stop()
endOfWordPosition or currentBufferPosition
# Public: Retrieves the buffer position of where the current word ends.
#
# * `options` (optional) {Object} with the following keys:
+5 -7
Ver Arquivo
@@ -11,7 +11,6 @@ Fold = require './fold'
Token = require './token'
Decoration = require './decoration'
Marker = require './marker'
textUtils = require './text-utils'
Grim = require 'grim'
class BufferToScreenConversionError extends Error
@@ -654,7 +653,7 @@ class DisplayBuffer extends Model
charWidths = @getScopedCharWidths(token.scopes)
valueIndex = 0
while valueIndex < token.value.length
if textUtils.isPairedCharacter(token.value, valueIndex)
if token.hasPairedCharacter
char = token.value.substr(valueIndex, 2)
charLength = 2
valueIndex += 2
@@ -683,7 +682,7 @@ class DisplayBuffer extends Model
charWidths = @getScopedCharWidths(token.scopes)
valueIndex = 0
while valueIndex < token.value.length
if textUtils.isPairedCharacter(token.value, valueIndex)
if token.hasPairedCharacter
char = token.value.substr(valueIndex, 2)
charLength = 2
valueIndex += 2
@@ -736,9 +735,7 @@ class DisplayBuffer extends Model
#
# Returns a {Point}.
screenPositionForBufferPosition: (bufferPosition, options) ->
# TODO: Expand this exception to cover all versions once we burn it in on non-release builds
if @isDestroyed() and not atom.isReleasedVersion()
throw new Error("This TextEditor has been destroyed")
throw new Error("This TextEditor has been destroyed") if @isDestroyed()
{ row, column } = @buffer.clipPosition(bufferPosition)
[startScreenRow, endScreenRow] = @rowMap.screenRowRangeForBufferRow(row)
@@ -1078,8 +1075,9 @@ class DisplayBuffer extends Model
destroyed: ->
marker.unsubscribe() for id, marker of @markers
@tokenizedBuffer.destroy()
@scopedConfigSubscriptions.dispose()
@unsubscribe()
@tokenizedBuffer.destroy()
logLines: (start=0, end=@getLastRow()) ->
for row in [start..end]
+6 -2
Ver Arquivo
@@ -16,12 +16,12 @@ GutterComponent = React.createClass
measuredWidth: null
render: ->
{scrollHeight, scrollViewHeight, onMouseDown, backgroundColor, gutterBackgroundColor} = @props
{scrollHeight, scrollViewHeight, backgroundColor, gutterBackgroundColor} = @props
if gutterBackgroundColor isnt 'rbga(0, 0, 0, 0)'
backgroundColor = gutterBackgroundColor
div className: 'gutter', onClick: @onClick, onMouseDown: @onMouseDown,
div className: 'gutter',
div className: 'line-numbers', ref: 'lineNumbers', style:
height: Math.max(scrollHeight, scrollViewHeight)
WebkitTransform: @getTransform()
@@ -45,6 +45,10 @@ GutterComponent = React.createClass
@appendDummyLineNumber()
@updateLineNumbers() if @props.performedInitialMeasurement
node = @getDOMNode()
node.addEventListener 'click', @onClick
node.addEventListener 'mousedown', @onMouseDown
# Only update the gutter if the visible row range has changed or if a
# non-zero-delta change to the screen lines has occurred within the current
# visible row range.
+16 -9
Ver Arquivo
@@ -14,9 +14,9 @@ HighlightComponent = React.createClass
div {className},
if endPixelPosition.top is startPixelPosition.top
@renderSingleLineRegions()
@renderSingleLineRegions(decoration.deprecatedRegionClass)
else
@renderMultiLineRegions()
@renderMultiLineRegions(decoration.deprecatedRegionClass)
componentDidMount: ->
{editor, decoration} = @props
@@ -41,25 +41,32 @@ HighlightComponent = React.createClass
removeFlashClass = -> node.classList.remove(flash.class)
@flashTimeoutId = setTimeout(removeFlashClass, flash.duration)
renderSingleLineRegions: ->
renderSingleLineRegions: (regionClass) ->
{startPixelPosition, endPixelPosition, lineHeightInPixels} = @props
className = 'region'
className += " #{regionClass}" if regionClass?
[
div className: 'region', key: 0, style:
div className: className, key: 0, style:
top: startPixelPosition.top
height: lineHeightInPixels
left: startPixelPosition.left
width: endPixelPosition.left - startPixelPosition.left
]
renderMultiLineRegions: ->
renderMultiLineRegions: (regionClass) ->
{startPixelPosition, endPixelPosition, lineHeightInPixels} = @props
className = 'region'
className += " #{regionClass}" if regionClass?
regions = []
index = 0
# First row, extending from selection start to the right side of screen
regions.push(
div className: 'region', key: index++, style:
div className: className, key: index++, style:
top: startPixelPosition.top
left: startPixelPosition.left
height: lineHeightInPixels
@@ -69,7 +76,7 @@ HighlightComponent = React.createClass
# Middle rows, extending from left side to right side of screen
if endPixelPosition.top - startPixelPosition.top > lineHeightInPixels
regions.push(
div className: 'region', key: index++, style:
div className: className, key: index++, style:
top: startPixelPosition.top + lineHeightInPixels
height: endPixelPosition.top - startPixelPosition.top - lineHeightInPixels
left: 0
@@ -78,7 +85,7 @@ HighlightComponent = React.createClass
# Last row, extending from left side of screen to selection end
regions.push(
div className: 'region', key: index, style:
div className: className, key: index, style:
top: endPixelPosition.top
height: lineHeightInPixels
left: 0
@@ -88,4 +95,4 @@ HighlightComponent = React.createClass
regions
shouldComponentUpdate: (newProps) ->
not isEqualForProperties(newProps, @props, 'startPixelPosition', 'endPixelPosition', 'lineHeightInPixels')
not isEqualForProperties(newProps, @props, 'startPixelPosition', 'endPixelPosition', 'lineHeightInPixels', 'decoration')
+7 -1
Ver Arquivo
@@ -17,9 +17,15 @@ HighlightsComponent = React.createClass
highlightComponents = []
for markerId, {startPixelPosition, endPixelPosition, decorations} of highlightDecorations
for decoration in decorations
highlightComponents.push(HighlightComponent({editor, key: "#{markerId}-#{decoration.class}", startPixelPosition, endPixelPosition, decoration, lineHeightInPixels}))
highlightComponents.push(HighlightComponent({editor, key: "#{markerId}-#{decoration.id}", startPixelPosition, endPixelPosition, decoration, lineHeightInPixels}))
highlightComponents
componentDidMount: ->
if atom.config.get('editor.useShadowDOM')
insertionPoint = document.createElement('content')
insertionPoint.setAttribute('select', '.underlayer')
@getDOMNode().appendChild(insertionPoint)
shouldComponentUpdate: (newProps) ->
not isEqualForProperties(newProps, @props, 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth', 'scopedCharacterWidthsChangeCount')
+5 -10
Ver Arquivo
@@ -7,16 +7,17 @@ InputComponent = React.createClass
displayName: 'InputComponent'
render: ->
{className, style, onFocus, onBlur} = @props
{className, style} = @props
input {className, style, onFocus, onBlur, 'data-react-skip-selection-restoration': true}
input {className, style, 'data-react-skip-selection-restoration': true}
getInitialState: ->
{lastChar: ''}
componentDidMount: ->
@getDOMNode().addEventListener 'paste', @onPaste
@getDOMNode().addEventListener 'compositionupdate', @onCompositionUpdate
node = @getDOMNode()
node.addEventListener 'paste', @onPaste
node.addEventListener 'compositionupdate', @onCompositionUpdate
# Don't let text accumulate in the input forever, but avoid excessive reflows
componentDidUpdate: ->
@@ -34,11 +35,5 @@ InputComponent = React.createClass
onPaste: (e) ->
e.preventDefault()
onFocus: ->
@props.onFocus?()
onBlur: ->
@props.onBlur?()
focus: ->
@getDOMNode().focus()
+8 -3
Ver Arquivo
@@ -7,7 +7,6 @@ React = require 'react-atom-fork'
Decoration = require './decoration'
CursorsComponent = require './cursors-component'
HighlightsComponent = require './highlights-component'
textUtils = require './text-utils'
DummyLineNode = $$(-> @div className: 'line', style: 'position: absolute; visibility: hidden;', => @span 'x')[0]
AcceptFilter = {acceptNode: -> NodeFilter.FILTER_ACCEPT}
@@ -58,6 +57,12 @@ LinesComponent = React.createClass
@lineIdsByScreenRow = {}
@renderedDecorationsByLineId = {}
componentDidMount: ->
if atom.config.get('editor.useShadowDOM')
insertionPoint = document.createElement('content')
insertionPoint.setAttribute('select', '.overlayer')
@getDOMNode().appendChild(insertionPoint)
shouldComponentUpdate: (newProps) ->
return true unless isEqualForProperties(newProps, @props,
'renderedRowRange', 'lineDecorations', 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth',
@@ -309,12 +314,12 @@ LinesComponent = React.createClass
iterator = null
charIndex = 0
for {value, scopes}, tokenIndex in tokenizedLine.tokens
for {value, scopes, hasPairedCharacter} in tokenizedLine.tokens
charWidths = editor.getScopedCharWidths(scopes)
valueIndex = 0
while valueIndex < value.length
if textUtils.isPairedCharacter(value, valueIndex)
if hasPairedCharacter
char = value.substr(valueIndex, 2)
charLength = 2
valueIndex += 2
+1 -1
Ver Arquivo
@@ -192,7 +192,7 @@ resolveModulePath = (relativePath, parentModule) ->
return
registerBuiltins = (devMode) ->
if devMode
if devMode or not cache.resourcePath.startsWith("#{process.resourcesPath}#{path.sep}")
fs = require 'fs-plus'
atomCoffeePath = path.join(cache.resourcePath, 'exports', 'atom.coffee')
cache.builtins.atom = atomCoffeePath if fs.isFileSync(atomCoffeePath)
+19 -11
Ver Arquivo
@@ -50,6 +50,7 @@ class Package
keymaps: null
menus: null
stylesheets: null
stylesheetDisposables: null
grammars: null
scopedProperties: null
mainModulePath: null
@@ -175,16 +176,24 @@ class Package
activateStylesheets: ->
return if @stylesheetsActivated
type = @getStylesheetType()
for [stylesheetPath, content] in @stylesheets
atom.themes.applyStylesheet(stylesheetPath, content, type)
group = @getStylesheetType()
@stylesheetDisposables = new CompositeDisposable
for [sourcePath, source] in @stylesheets
if match = path.basename(sourcePath).match(/[^.]*\.([^.]*)\./)
context = match[1]
else if @metadata.theme is 'syntax'
context = 'atom-text-editor'
else
context = undefined
@stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, group, context}))
@stylesheetsActivated = true
activateResources: ->
@activationDisposables = new CompositeDisposable
@activationDisposables.add(atom.keymaps.add(keymapPath, map)) for [keymapPath, map] in @keymaps
@activationDisposables.add(atom.contextMenu.add(map['context-menu'])) for [menuPath, map] in @menus
@activationDisposables.add(atom.menu.add(map.menu)) for [menuPath, map] in @menus when map.menu
@activationDisposables.add(atom.contextMenu.add(map['context-menu'])) for [menuPath, map] in @menus when map['context-menu']?
@activationDisposables.add(atom.menu.add(map['menu'])) for [menuPath, map] in @menus when map['menu']?
unless @grammarsActivated
grammar.activate() for grammar in @grammars
@@ -320,7 +329,7 @@ class Package
deactivateResources: ->
grammar.deactivate() for grammar in @grammars
scopedProperties.deactivate() for scopedProperties in @scopedProperties
atom.themes.removeStylesheet(stylesheetPath) for [stylesheetPath] in @stylesheets
@stylesheetDisposables?.dispose()
@activationDisposables?.dispose()
@stylesheetsActivated = false
@grammarsActivated = false
@@ -329,11 +338,10 @@ class Package
reloadStylesheets: ->
oldSheets = _.clone(@stylesheets)
@loadStylesheets()
atom.themes.removeStylesheet(stylesheetPath) for [stylesheetPath] in oldSheets
@reloadStylesheet(stylesheetPath, content) for [stylesheetPath, content] in @stylesheets
reloadStylesheet: (stylesheetPath, content) ->
atom.themes.applyStylesheet(stylesheetPath, content, @getStylesheetType())
@stylesheetDisposables.dispose()
@stylesheetDisposables = new CompositeDisposable
@stylesheetsActivated = false
@activateStylesheets()
requireMainModule: ->
return @mainModule if @mainModule?
+8
Ver Arquivo
@@ -40,6 +40,8 @@ class PaneContainer extends Model
@registerViewProviders()
@setRoot(params?.root ? new Pane)
@setActivePane(@getPanes()[0]) unless @getActivePane()
@destroyEmptyPanes() if params?.destroyEmptyPanes
@monitorActivePaneItem()
@@ -137,6 +139,9 @@ class PaneContainer extends Model
setActivePane: (activePane) ->
if activePane isnt @activePane
unless activePane in @getPanes()
throw new Error("Setting active pane that is not present in pane container")
@activePane = activePane
@emitter.emit 'did-change-active-pane', @activePane
@activePane
@@ -147,6 +152,9 @@ class PaneContainer extends Model
paneForUri: (uri) ->
find @getPanes(), (pane) -> pane.itemForUri(uri)?
paneForItem: (item) ->
@getPanes().find (pane) -> item in pane.getItems()
saveAll: ->
pane.saveItems() for pane in @getPanes()
+40 -35
Ver Arquivo
@@ -28,39 +28,21 @@ class PaneElement extends HTMLElement
@itemViews.setAttribute 'class', 'item-views'
subscribeToDOMEvents: ->
@addEventListener 'focusin', => @model.focus()
@addEventListener 'focusout', => @model.blur()
@addEventListener 'focus', => @getActiveView()?.focus()
handleFocus = (event) =>
@model.focus()
if event.target is this and view = @getActiveView()
view.focus()
event.stopPropagation()
handleBlur = (event) =>
@model.blur() unless @contains(event.relatedTarget)
@addEventListener 'focus', handleFocus, true
@addEventListener 'blur', handleBlur, true
createSpacePenShim: ->
@__spacePenView = new PaneView(this)
addCommands = (handlersByName) =>
for name, handler of handlersByName
do (handler) =>
@__spacePenView.command name, => handler.apply(this, arguments)
addCommands(
'pane:save-items': -> @getModel().saveItems()
'pane:show-next-item': -> @getModel().activateNextItem()
'pane:show-previous-item': -> @getModel().activatePreviousItem()
'pane:show-item-1': -> @getModel().activateItemAtIndex(0)
'pane:show-item-2': -> @getModel().activateItemAtIndex(1)
'pane:show-item-3': -> @getModel().activateItemAtIndex(2)
'pane:show-item-4': -> @getModel().activateItemAtIndex(3)
'pane:show-item-5': -> @getModel().activateItemAtIndex(4)
'pane:show-item-6': -> @getModel().activateItemAtIndex(5)
'pane:show-item-7': -> @getModel().activateItemAtIndex(6)
'pane:show-item-8': -> @getModel().activateItemAtIndex(7)
'pane:show-item-9': -> @getModel().activateItemAtIndex(8)
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)
'pane:split-down': -> @getModel().splitDown(copyActiveItem: true)
'pane:close': -> @getModel().destroy()
'pane:close-other-items': -> @getModel().destroyInactiveItems()
)
getModel: -> @model
setModel: (@model) ->
@@ -86,16 +68,16 @@ class PaneElement extends HTMLElement
hasFocus = @hasFocus()
itemView = @model.getView(item)
unless @itemViews.contains(itemView)
@itemViews.appendChild(itemView)
callAttachHooks(itemView)
for child in @itemViews.children
if child is itemView
@showItemView(child) if @attached
else
@hideItemView(child)
unless @itemViews.contains(itemView)
@itemViews.appendChild(itemView)
callAttachHooks(itemView)
itemView.focus() if hasFocus
showItemView: (itemView) ->
@@ -107,8 +89,9 @@ class PaneElement extends HTMLElement
hideItemView: (itemView) ->
inlineDisplayStyle = itemView.style.display
@inlineDisplayStyles.set(itemView, inlineDisplayStyle) if inlineDisplayStyle?
itemView.style.display = 'none'
unless inlineDisplayStyle is 'none'
@inlineDisplayStyles.set(itemView, inlineDisplayStyle) if inlineDisplayStyle?
itemView.style.display = 'none'
itemRemoved: ({item, index, destroyed}) ->
if viewToRemove = @model.getView(item)
@@ -123,4 +106,26 @@ class PaneElement extends HTMLElement
hasFocus: ->
this is document.activeElement or @contains(document.activeElement)
atom.commands.add 'atom-pane',
'pane:save-items': -> @getModel().saveItems()
'pane:show-next-item': -> @getModel().activateNextItem()
'pane:show-previous-item': -> @getModel().activatePreviousItem()
'pane:show-item-1': -> @getModel().activateItemAtIndex(0)
'pane:show-item-2': -> @getModel().activateItemAtIndex(1)
'pane:show-item-3': -> @getModel().activateItemAtIndex(2)
'pane:show-item-4': -> @getModel().activateItemAtIndex(3)
'pane:show-item-5': -> @getModel().activateItemAtIndex(4)
'pane:show-item-6': -> @getModel().activateItemAtIndex(5)
'pane:show-item-7': -> @getModel().activateItemAtIndex(6)
'pane:show-item-8': -> @getModel().activateItemAtIndex(7)
'pane:show-item-9': -> @getModel().activateItemAtIndex(8)
'pane:move-item-right': -> @getModel().moveItemRight()
'pane:move-item-left': -> @getModel().moveItemLeft()
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)
'pane:split-down': -> @getModel().splitDown(copyActiveItem: true)
'pane:close': -> @getModel().close()
'pane:close-other-items': -> @getModel().destroyInactiveItems()
module.exports = PaneElement = document.registerElement 'atom-pane', prototype: PaneElement.prototype
+2 -8
Ver Arquivo
@@ -119,7 +119,7 @@ class PaneView extends View
deprecate 'Please return a Disposable object from your ::onDidChangeTitle method!' unless disposable?.dispose?
@activeItemDisposables.add(disposable) if disposable?.dispose?
else if item.on?
deprecate '::on methods for items are no longer supported. If you would like your item to support title change behavior, please implement a ::onDidChangeTitle() method.'
deprecate 'If you would like your pane item to support title change behavior, please implement a ::onDidChangeTitle() method. ::on methods for items are no longer supported. If not, ignore this message.'
disposable = item.on('title-changed', @activeItemTitleChanged)
@activeItemDisposables.add(disposable) if disposable?.dispose?
@@ -128,16 +128,10 @@ class PaneView extends View
deprecate 'Please return a Disposable object from your ::onDidChangeModified method!' unless disposable?.dispose?
@activeItemDisposables.add(disposable) if disposable?.dispose?
else if item.on?
deprecate '::on methods for items are no longer supported. If you would like your item to support modified behavior, please implement a ::onDidChangeModified() method.'
deprecate 'If you would like your pane item to support modified behavior, please implement a ::onDidChangeModified() method. If not, ignore this message. ::on methods for items are no longer supported.'
item.on('modified-status-changed', @activeItemModifiedChanged)
@activeItemDisposables.add(disposable) if disposable?.dispose?
view = @model.getView(item).__spacePenView
otherView.hide() for otherView in @itemViews.children().not(view).views()
@itemViews.append(view) unless view.parent().is(@itemViews)
view.show() if @attached
view.focus() if @hasFocus()
@trigger 'pane:active-item-changed', [item]
onItemAdded: ({item, index}) =>
+22
Ver Arquivo
@@ -289,6 +289,18 @@ class Pane extends Model
else
@activateItemAtIndex(@items.length - 1)
# Public: Move the active tab to the right.
moveItemRight: ->
index = @getActiveItemIndex()
rightItemIndex = index + 1
@moveItem(@getActiveItem(), rightItemIndex) unless rightItemIndex > @items.length - 1
# Public: Move the active tab to the left
moveItemLeft: ->
index = @getActiveItemIndex()
leftItemIndex = index - 1
@moveItem(@getActiveItem(), leftItemIndex) unless leftItemIndex < 0
# Public: Get the index of the active item.
#
# Returns a {Number}.
@@ -502,6 +514,8 @@ class Pane extends Model
# Public: Makes this pane the *active* pane, causing it to gain focus.
activate: ->
throw new Error("Pane has been destroyed") if @isDestroyed()
@container?.setActivePane(this)
@emit 'activated'
@emitter.emit 'did-activate'
@@ -606,3 +620,11 @@ class Pane extends Model
rightmostSibling
else
@splitRight()
close: ->
@destroy() if @confirmClose()
confirmClose: ->
for item in @getItems()
return false unless @promptToSaveItem(item)
true
+15 -3
Ver Arquivo
@@ -14,17 +14,29 @@ class PanelContainerElement extends HTMLElement
@setAttribute('location', @model.getLocation())
panelAdded: ({panel, index}) ->
panelElement = panel.getView()
panelElement.setAttribute('location', @model.getLocation())
if index >= @childNodes.length
@appendChild(panel.getView())
@appendChild(panelElement)
else
referenceItem = @childNodes[index + 1]
@insertBefore(panel.getView(), referenceItem)
@insertBefore(panelElement, referenceItem)
if @model.isModal()
@hideAllPanelsExcept(panel)
@subscriptions.add panel.onDidChangeVisible (visible) =>
@hideAllPanelsExcept(panel) if visible
panelRemoved: ({panel, index}) ->
@removeChild(@childNodes[index])
@removeChild(panel.getView())
destroyed: ->
@subscriptions.dispose()
@parentNode?.removeChild(this)
hideAllPanelsExcept: (excludedPanel) ->
for panel in @model.getPanels()
panel.hide() unless panel is excludedPanel
return
module.exports = PanelContainerElement = document.registerElement 'atom-panel-container', prototype: PanelContainerElement.prototype
+5 -3
Ver Arquivo
@@ -8,7 +8,7 @@ class PanelContainer
@panels = []
destroy: ->
pane.destroy() for pane in @getPanels()
panel.destroy() for panel in @getPanels()
@subscriptions.dispose()
@emitter.emit 'did-destroy', this
@emitter.dispose()
@@ -34,10 +34,12 @@ class PanelContainer
getLocation: -> @location
isModal: -> @location is 'modal'
getPanels: -> @panels
addPanel: (panel) ->
@subscriptions.add panel.onDidDestroy(@panelDestoryed.bind(this))
@subscriptions.add panel.onDidDestroy(@panelDestroyed.bind(this))
index = @getPanelIndex(panel)
if index is @panels.length
@@ -48,7 +50,7 @@ class PanelContainer
@emitter.emit 'did-add-panel', {panel, index}
panel
panelDestoryed: (panel) ->
panelDestroyed: (panel) ->
index = @panels.indexOf(panel)
if index > -1
@panels.splice(index, 1)
+1
Ver Arquivo
@@ -12,6 +12,7 @@ class PanelElement extends HTMLElement
@appendChild(view)
callAttachHooks(view) # for backward compatibility with SpacePen views
@classList.add(@model.getClassName().split(' ')...) if @model.getClassName()?
@subscriptions.add @model.onDidChangeVisible(@visibleChanged.bind(this))
@subscriptions.add @model.onDidDestroy(@destroyed.bind(this))
+4 -1
Ver Arquivo
@@ -14,7 +14,7 @@ class Panel
Section: Construction and Destruction
###
constructor: ({@viewRegistry, @item, @visible, @priority}) ->
constructor: ({@viewRegistry, @item, @visible, @priority, @className}) ->
@emitter = new Emitter
@visible ?= true
@priority ?= 100
@@ -22,6 +22,7 @@ class Panel
# Public: Destroy and remove this panel from the UI.
destroy: ->
@emitter.emit 'did-destroy', this
@emitter.dispose()
###
Section: Event Subscription
@@ -62,6 +63,8 @@ class Panel
# Public: Returns a {Number} indicating this panel's priority.
getPriority: -> @priority
getClassName: -> @className
# Public: Returns a {Boolean} true when the panel is visible.
isVisible: -> @visible
+4 -1
Ver Arquivo
@@ -196,7 +196,8 @@ class Project extends Model
excludeVcsIgnores: atom.config.get('core.excludeVcsIgnoredPaths')
exclusions: atom.config.get('core.ignoredNames')
task = Task.once require.resolve('./scan-handler'), @getPath(), regex.source, searchOptions, ->
# TODO: need to support all paths in @getPaths()
task = Task.once require.resolve('./scan-handler'), @getPaths()[0], regex.source, searchOptions, ->
deferred.resolve()
task.on 'scan:result-found', (result) =>
@@ -322,6 +323,7 @@ class Project extends Model
# Still needed when deserializing a tokenized buffer
buildBufferSync: (absoluteFilePath) ->
buffer = new TextBuffer({filePath: absoluteFilePath})
buffer.setEncoding(atom.config.get('core.fileEncoding'))
@addBuffer(buffer)
buffer.loadSync()
buffer
@@ -337,6 +339,7 @@ class Project extends Model
throw new Error("Atom can only handle files < 2MB for now.")
buffer = new TextBuffer({filePath: absoluteFilePath})
buffer.setEncoding(atom.config.get('core.fileEncoding'))
@addBuffer(buffer)
buffer.load()
.then((buffer) -> buffer)
+6 -1
Ver Arquivo
@@ -23,7 +23,7 @@ ScrollbarComponent = React.createClass
style.right = verticalScrollbarWidth if scrollableInOppositeDirection
style.height = horizontalScrollbarHeight
div {className, style, @onScroll},
div {className, style},
switch orientation
when 'vertical'
div className: 'scrollbar-content', style: {height: scrollHeight}
@@ -36,6 +36,11 @@ ScrollbarComponent = React.createClass
unless orientation is 'vertical' or orientation is 'horizontal'
throw new Error("Must specify an orientation property of 'vertical' or 'horizontal'")
@getDOMNode().addEventListener 'scroll', @onScroll
componentWillUnmount: ->
@getDOMNode().removeEventListener 'scroll', @onScroll
shouldComponentUpdate: (newProps) ->
return true if newProps.visible isnt @props.visible
+2 -2
Ver Arquivo
@@ -57,7 +57,7 @@ class SelectListView extends View
initialize: ->
@filterEditorView.getEditor().getBuffer().onDidChange =>
@schedulePopulateList()
@filterEditorView.hiddenInput.on 'focusout', =>
@filterEditorView.on 'blur', =>
@cancel() unless @cancelling
# This prevents the focusout event from firing on the filter editor view
@@ -254,7 +254,7 @@ class SelectListView extends View
# Extended: Store the currently focused element. This element will be given
# back focus when {::cancel} is called.
storeFocusedElement: ->
@previouslyFocusedElement = $(':focus')
@previouslyFocusedElement = $(document.activeElement)
###
Section: Private
+3 -2
Ver Arquivo
@@ -322,7 +322,7 @@ class Selection extends Model
# * `row` The line {Number} to select (default: the row of the cursor).
selectLine: (row=@cursor.getBufferPosition().row) ->
range = @editor.bufferRangeForBufferRow(row, includeNewline: true)
@setBufferRange(@getBufferRange().union(range))
@setBufferRange(@getBufferRange().union(range), autoscroll: true)
@linewise = true
@wordwise = false
@initialScreenRange = @getScreenRange()
@@ -348,6 +348,7 @@ class Selection extends Model
# * `autoIndentNewline` if `true`, indent newline appropriately.
# * `autoDecreaseIndent` if `true`, decreases indent level appropriately
# (for example, when a closing bracket is inserted).
# * `normalizeLineEndings` (optional) {Boolean} (default: true)
# * `undo` if `skip`, skips the undo stack for this operation.
insertText: (text, options={}) ->
oldBufferRange = @getBufferRange()
@@ -359,7 +360,7 @@ class Selection extends Model
if options.indentBasis? and not options.autoIndent
text = @normalizeIndents(text, options.indentBasis)
newBufferRange = @editor.buffer.setTextInRange(oldBufferRange, text, pick(options, 'undo'))
newBufferRange = @editor.buffer.setTextInRange(oldBufferRange, text, pick(options, 'undo', 'normalizeLineEndings'))
if options.select
@setBufferRange(newBufferRange, reversed: wasReversed)
+17 -2
Ver Arquivo
@@ -7,7 +7,7 @@ Subscriber.includeInto(SpacePen.View)
jQuery = SpacePen.jQuery
JQueryCleanData = jQuery.cleanData
jQuery.cleanData = (elements) ->
jQuery(element).view()?.unsubscribe() for element in elements
jQuery(element).view()?.unsubscribe?() for element in elements
JQueryCleanData(elements)
SpacePenCallRemoveHooks = SpacePen.callRemoveHooks
@@ -20,13 +20,16 @@ NativeEventNames.add(nativeEvent) for nativeEvent in ["blur", "focus", "focusin"
"focusout", "load", "resize", "scroll", "unload", "click", "dblclick", "mousedown",
"mouseup", "mousemove", "mouseover", "mouseout", "mouseenter", "mouseleave", "change",
"select", "submit", "keydown", "keypress", "keyup", "error", "contextmenu", "textInput",
"textinput"]
"textinput", "beforeunload"]
JQueryTrigger = jQuery.fn.trigger
jQuery.fn.trigger = (eventName, data) ->
if NativeEventNames.has(eventName) or typeof eventName is 'object'
JQueryTrigger.call(this, eventName, data)
else
data ?= {}
data.jQueryTrigger = true
for element in this
atom.commands.dispatch(element, eventName, data)
this
@@ -78,6 +81,18 @@ jQuery.event.remove = (elem, types, originalHandler, selector, mappedTypes) ->
handler = HandlersByOriginalHandler.get(originalHandler) ? originalHandler
JQueryEventRemove(elem, types, handler, selector, mappedTypes, RemoveEventListener if atom?.commands?)
JQueryContains = jQuery.contains
jQuery.contains = (a, b) ->
shadowRoot = null
currentNode = b
while currentNode
if currentNode instanceof ShadowRoot and a.contains(currentNode.host)
return true
currentNode = currentNode.parentNode
JQueryContains.call(this, a, b)
tooltipDefaults =
delay:
show: 1000
+1
Ver Arquivo
@@ -25,6 +25,7 @@ class StyleManager
addStyleSheet: (source, params) ->
sourcePath = params?.sourcePath
context = params?.context
group = params?.group
if sourcePath? and styleElement = @styleElementsBySourcePath[sourcePath]
+38 -7
Ver Arquivo
@@ -1,8 +1,8 @@
{Emitter, CompositeDisposable} = require 'event-kit'
class StylesElement extends HTMLElement
createdCallback: ->
@emitter = new Emitter
subscriptions: null
context: null
onDidAddStyleElement: (callback) ->
@emitter.on 'did-add-style-element', callback
@@ -13,15 +13,42 @@ class StylesElement extends HTMLElement
onDidUpdateStyleElement: (callback) ->
@emitter.on 'did-update-style-element', callback
attachedCallback: ->
@subscriptions = new CompositeDisposable
createdCallback: ->
@emitter = new Emitter
@styleElementClonesByOriginalElement = new WeakMap
attachedCallback: ->
@initialize()
detachedCallback: ->
@subscriptions.dispose()
@subscriptions = null
attributeChangedCallback: (attrName, oldVal, newVal) ->
@contextChanged() if attrName is 'context'
initialize: ->
return if @subscriptions?
@subscriptions = new CompositeDisposable
@context = @getAttribute('context') ? undefined
@subscriptions.add atom.styles.observeStyleElements(@styleElementAdded.bind(this))
@subscriptions.add atom.styles.onDidRemoveStyleElement(@styleElementRemoved.bind(this))
@subscriptions.add atom.styles.onDidUpdateStyleElement(@styleElementUpdated.bind(this))
contextChanged: ->
return unless @subscriptions?
@styleElementRemoved(child) for child in Array::slice.call(@children)
@context = @getAttribute('context')
@styleElementAdded(styleElement) for styleElement in atom.styles.getStyleElements()
styleElementAdded: (styleElement) ->
return unless @styleElementMatchesContext(styleElement)
styleElementClone = styleElement.cloneNode(true)
styleElementClone.context = styleElement.context
@styleElementClonesByOriginalElement.set(styleElement, styleElementClone)
group = styleElement.getAttribute('group')
@@ -35,16 +62,20 @@ class StylesElement extends HTMLElement
@emitter.emit 'did-add-style-element', styleElementClone
styleElementRemoved: (styleElement) ->
styleElementClone = @styleElementClonesByOriginalElement.get(styleElement)
return unless @styleElementMatchesContext(styleElement)
styleElementClone = @styleElementClonesByOriginalElement.get(styleElement) ? styleElement
styleElementClone.remove()
@emitter.emit 'did-remove-style-element', styleElementClone
styleElementUpdated: (styleElement) ->
return unless @styleElementMatchesContext(styleElement)
styleElementClone = @styleElementClonesByOriginalElement.get(styleElement)
styleElementClone.textContent = styleElement.textContent
@emitter.emit 'did-update-style-element', styleElementClone
detachedCallback: ->
@subscriptions.dispose()
styleElementMatchesContext: (styleElement) ->
not @context? or styleElement.context is @context
module.exports = StylesElement = document.registerElement 'atom-styles', prototype: StylesElement.prototype
+48 -36
Ver Arquivo
@@ -93,7 +93,7 @@ TextEditorComponent = React.createClass
className += ' is-focused' if focused
className += ' has-selection' if hasSelection
div {className, style, tabIndex: -1},
div {className, style},
if @shouldRenderGutter()
GutterComponent {
ref: 'gutter', onMouseDown: @onGutterMouseDown, lineDecorations,
@@ -102,13 +102,11 @@ TextEditorComponent = React.createClass
@useHardwareAcceleration, @performedInitialMeasurement, @backgroundColor, @gutterBackgroundColor
}
div ref: 'scrollView', className: 'scroll-view', onMouseDown: @onMouseDown,
div ref: 'scrollView', className: 'scroll-view',
InputComponent
ref: 'input'
className: 'hidden-input'
style: hiddenInputStyle
onFocus: @onInputFocused
onBlur: @onInputBlurred
LinesComponent {
ref: 'lines',
@@ -175,16 +173,16 @@ TextEditorComponent = React.createClass
@setScrollSensitivity(atom.config.get('editor.scrollSensitivity'))
componentDidMount: ->
{editor} = @props
{editor, stylesElement} = @props
@observeEditor()
@listenForDOMEvents()
@subscribe atom.themes.onDidAddStylesheet @onStylesheetsChanged
@subscribe atom.themes.onDidUpdateStylesheet @onStylesheetsChanged
@subscribe atom.themes.onDidRemoveStylesheet @onStylesheetsChanged
@subscribe stylesElement.onDidAddStyleElement @onStylesheetsChanged
@subscribe stylesElement.onDidUpdateStyleElement @onStylesheetsChanged
@subscribe stylesElement.onDidRemoveStyleElement @onStylesheetsChanged
unless atom.themes.isInitialLoadComplete()
@subscribe atom.themes.onDidReloadAll @onStylesheetsChanged
@subscribe atom.themes.onDidReloadAll @onAllThemesLoaded
@subscribe scrollbarStyle.changes, @refreshScrollbars
@domPollingIntervalId = setInterval(@pollDOM, @domPollingInterval)
@@ -193,10 +191,11 @@ TextEditorComponent = React.createClass
@checkForVisibilityChange()
componentWillUnmount: ->
{editor, parentView} = @props
{editor, hostElement} = @props
parentView.__spacePenView.trigger 'editor:will-be-removed', [parentView.__spacePenView]
hostElement.__spacePenView.trigger 'editor:will-be-removed', [hostElement.__spacePenView]
@unsubscribe()
@scopedConfigSubscriptions.dispose()
window.removeEventListener 'resize', @requestHeightAndWidthMeasurement
clearInterval(@domPollingIntervalId)
@domPollingIntervalId = null
@@ -214,9 +213,9 @@ TextEditorComponent = React.createClass
if @props.editor.isAlive()
@updateParentViewFocusedClassIfNeeded(prevState)
@updateParentViewMiniClassIfNeeded(prevState)
@props.parentView.__spacePenView.trigger 'cursor:moved' if cursorMoved
@props.parentView.__spacePenView.trigger 'selection:changed' if selectionChanged
@props.parentView.__spacePenView.trigger 'editor:display-updated'
@props.hostElement.__spacePenView.trigger 'cursor:moved' if cursorMoved
@props.hostElement.__spacePenView.trigger 'selection:changed' if selectionChanged
@props.hostElement.__spacePenView.trigger 'editor:display-updated'
becameVisible: ->
@updatesPaused = true
@@ -260,7 +259,7 @@ TextEditorComponent = React.createClass
@forceUpdate()
getTopmostDOMNode: ->
@props.parentView
@props.hostElement
getRenderedRowRange: ->
{editor, lineOverdrawMargin} = @props
@@ -377,8 +376,8 @@ TextEditorComponent = React.createClass
listenForDOMEvents: ->
node = @getDOMNode()
node.addEventListener 'mousewheel', @onMouseWheel
node.addEventListener 'focus', @onFocus # For some reason, React's built in focus events seem to bubble
node.addEventListener 'textInput', @onTextInput
@refs.scrollView.getDOMNode().addEventListener 'mousedown', @onMouseDown
scrollViewNode = @refs.scrollView.getDOMNode()
scrollViewNode.addEventListener 'scroll', @onScrollViewScroll
@@ -414,6 +413,9 @@ TextEditorComponent = React.createClass
observeConfig: ->
@subscribe atom.config.observe 'editor.useHardwareAcceleration', @setUseHardwareAcceleration
@subscribe atom.config.onDidChange 'editor.fontSize', @sampleFontStyling
@subscribe atom.config.onDidChange 'editor.fontFamily', @sampleFontStyling
@subscribe atom.config.onDidChange 'editor.lineHeight', @sampleFontStyling
onGrammarChanged: ->
{editor} = @props
@@ -427,8 +429,14 @@ TextEditorComponent = React.createClass
subscriptions.add atom.config.observe scopeDescriptor, 'editor.showLineNumbers', @setShowLineNumbers
subscriptions.add atom.config.observe scopeDescriptor, 'editor.scrollSensitivity', @setScrollSensitivity
onFocus: ->
@refs.input.focus() if @isMounted()
focused: ->
if @isMounted()
@setState(focused: true)
@refs.input.focus()
blurred: ->
if @isMounted()
@setState(focused: false)
onTextInput: (event) ->
event.stopPropagation()
@@ -449,13 +457,9 @@ TextEditorComponent = React.createClass
selectedLength = inputNode.selectionEnd - inputNode.selectionStart
editor.selectLeft() if selectedLength is 1
inputNode.value = event.data if editor.insertText(event.data)
onInputFocused: ->
@setState(focused: true)
onInputBlurred: ->
@setState(focused: false)
insertedRange = editor.transact atom.config.get('editor.undoGroupingInterval'), ->
editor.insertText(event.data)
inputNode.value = event.data if insertedRange
onVerticalScroll: (scrollTop) ->
{editor} = @props
@@ -620,11 +624,17 @@ TextEditorComponent = React.createClass
else
editor.setSelectedScreenRange([tailPosition, [dragRow + 1, 0]], preserveFolds: true)
onStylesheetsChanged: (stylesheet) ->
onStylesheetsChanged: (styleElement) ->
return unless @performedInitialMeasurement
return unless atom.themes.isInitialLoadComplete()
@refreshScrollbars() if not styleElement.sheet? or @containsScrollbarSelector(styleElement.sheet)
@handleStylingChange()
@refreshScrollbars() if not stylesheet? or @containsScrollbarSelector(stylesheet)
onAllThemesLoaded: ->
@refreshScrollbars()
@handleStylingChange()
handleStylingChange: ->
@sampleFontStyling()
@sampleBackgroundColors()
@remeasureCharacterWidths()
@@ -770,10 +780,10 @@ TextEditorComponent = React.createClass
measureHeightAndWidth: ->
return unless @isMounted()
{editor, parentView} = @props
{editor, hostElement} = @props
scrollViewNode = @refs.scrollView.getDOMNode()
{position} = getComputedStyle(parentView)
{height} = parentView.style
{position} = getComputedStyle(hostElement)
{height} = hostElement.style
if position is 'absolute' or height
if @autoHeight
@@ -805,9 +815,9 @@ TextEditorComponent = React.createClass
@remeasureCharacterWidths()
sampleBackgroundColors: (suppressUpdate) ->
{parentView} = @props
{hostElement} = @props
{showLineNumbers} = @state
{backgroundColor} = getComputedStyle(parentView)
{backgroundColor} = getComputedStyle(hostElement)
if backgroundColor isnt @backgroundColor
@backgroundColor = backgroundColor
@@ -906,10 +916,10 @@ TextEditorComponent = React.createClass
lineNumberNodeForScreenRow: (screenRow) -> @refs.gutter.lineNumberNodeForScreenRow(screenRow)
screenRowForNode: (node) ->
while node isnt document
while node?
if screenRow = node.dataset.screenRow
return parseInt(screenRow)
node = node.parentNode
node = node.parentElement
null
getFontSize: ->
@@ -976,11 +986,13 @@ TextEditorComponent = React.createClass
updateParentViewFocusedClassIfNeeded: (prevState) ->
if prevState.focused isnt @state.focused
@props.parentView.classList.toggle('is-focused', @state.focused)
@props.hostElement.classList.toggle('is-focused', @state.focused)
@props.rootElement.classList.toggle('is-focused', @state.focused)
updateParentViewMiniClassIfNeeded: (prevProps) ->
if prevProps.mini isnt @props.mini
@props.parentView.classList.toggle('mini', @props.mini)
@props.hostElement.classList.toggle('mini', @props.mini)
@props.rootElement.classList.toggle('mini', @props.mini)
runScrollBenchmark: ->
unless process.env.NODE_ENV is 'production'
+182 -109
Ver Arquivo
@@ -14,17 +14,39 @@ class TextEditorElement extends HTMLElement
focusOnAttach: false
createdCallback: ->
@subscriptions =
@initializeContent()
@createSpacePenShim()
@addEventListener 'focus', @focused.bind(this)
@addEventListener 'focusout', @focusedOut.bind(this)
@addEventListener 'blur', @blurred.bind(this)
initializeContent: (attributes) ->
@classList.add('editor', 'react', 'editor-colors')
@classList.add('editor')
@setAttribute('tabindex', -1)
if atom.config.get('editor.useShadowDOM')
@createShadowRoot()
@stylesElement = document.createElement('atom-styles')
@stylesElement.setAttribute('context', 'atom-text-editor')
@stylesElement.initialize()
@rootElement = document.createElement('div')
@rootElement.classList.add('shadow')
@shadowRoot.appendChild(@stylesElement)
@shadowRoot.appendChild(@rootElement)
if atom.themes.isInitialLoadComplete()
@observeGlobalStyles()
else
loadSubscription = atom.themes.onDidReloadAll(@observeGlobalStyles.bind(this))
else
@stylesElement = document.head.querySelector('atom-styles')
@rootElement = this
@rootElement.classList.add('editor', 'editor-colors')
createSpacePenShim: ->
TextEditorView ?= require './text-editor-view'
@__spacePenView = new TextEditorView(this)
@@ -35,6 +57,29 @@ class TextEditorElement extends HTMLElement
@component.checkForVisibilityChange()
@focus() if @focusOnAttach
observeGlobalStyles: ->
globalStyles = document.head.querySelector('atom-styles')
globalStyles.onDidAddStyleElement(@transferComputedStyles.bind(this))
@transferComputedStyles()
transferComputedStyles: ->
unless @hostOverrideStyleElement?
@hostOverrideStyleElement = document.createElement('style')
@shadowRoot.insertBefore(@hostOverrideStyleElement, @stylesElement.nextSibling)
{color, backgroundColor} = getComputedStyle(this)
@hostOverrideStyleElement.textContent = """
.editor-colors {
background-color: #{backgroundColor};
color: #{color};
}
.cursor {
border-color: #{color};
}
"""
setModel: (model) ->
throw new Error("Model already assigned on TextEditorElement") if @model?
return if model.isDestroyed()
@@ -43,6 +88,8 @@ class TextEditorElement extends HTMLElement
@mountComponent()
@addGrammarScopeAttribute()
@model.onDidChangeGrammar => @addGrammarScopeAttribute()
@addEncodingAttribute()
@model.onDidChangeEncoding => @addEncodingAttribute()
@model.onDidDestroy => @unmountComponent()
@__spacePenView.setModel(@model)
@model
@@ -62,12 +109,19 @@ class TextEditorElement extends HTMLElement
mountComponent: ->
@componentDescriptor ?= TextEditorComponent(
parentView: this
hostElement: this
rootElement: @rootElement
stylesElement: @stylesElement
editor: @model
mini: @model.mini
lineOverdrawMargin: @lineOverdrawMargin
)
@component = React.renderComponent(@componentDescriptor, this)
@component = React.renderComponent(@componentDescriptor, @rootElement)
unless atom.config.get('editor.useShadowDOM')
inputNode = @component.refs.input.getDOMNode()
inputNode.addEventListener 'focus', @focused.bind(this)
inputNode.addEventListener 'blur', => @dispatchEvent(new FocusEvent('blur', bubbles: false))
unmountComponent: ->
return unless @component?.isMounted()
@@ -77,132 +131,151 @@ class TextEditorElement extends HTMLElement
focused: ->
if @component?
@component.onFocus()
@component.focused()
else
@focusOnAttach = true
focusedOut: (event) ->
event.stopImmediatePropagation() if @contains(event.relatedTarget)
blurred: (event) ->
event.stopImmediatePropagation() if @contains(event.relatedTarget)
unless atom.config.get('editor.useShadowDOM')
if event.relatedTarget is @component?.refs.input?.getDOMNode()
event.stopImmediatePropagation()
return
@component?.blurred()
addGrammarScopeAttribute: ->
grammarScope = @model.getGrammar()?.scopeName?.replace(/\./g, ' ')
@setAttribute('data-grammar', grammarScope)
@dataset.grammar = grammarScope
addEncodingAttribute: ->
@dataset.encoding = @model.getEncoding()
hasFocus: ->
this is document.activeElement or @contains(document.activeElement)
stopCommandEventPropagation = (commandListeners) ->
stopEventPropagation = (commandListeners) ->
newCommandListeners = {}
for commandName, commandListener of commandListeners
do (commandListener) ->
newCommandListeners[commandName] = (event) ->
event.stopPropagation()
commandListener.call(this, event)
commandListener.call(@getModel(), event)
newCommandListeners
atom.commands.add 'atom-text-editor', stopCommandEventPropagation(
'core:move-left': -> @getModel().moveLeft()
'core:move-right': -> @getModel().moveRight()
'core:select-left': -> @getModel().selectLeft()
'core:select-right': -> @getModel().selectRight()
'core:select-all': -> @getModel().selectAll()
'core:backspace': -> @getModel().backspace()
'core:delete': -> @getModel().delete()
'core:undo': -> @getModel().undo()
'core:redo': -> @getModel().redo()
'core:cut': -> @getModel().cutSelectedText()
'core:copy': -> @getModel().copySelectedText()
'core:paste': -> @getModel().pasteText()
'editor:move-to-previous-word': -> @getModel().moveToPreviousWord()
'editor:select-word': -> @getModel().selectWordsContainingCursors()
'editor:consolidate-selections': (event) -> event.abortKeyBinding() unless @getModel().consolidateSelections()
'editor:delete-to-beginning-of-word': -> @getModel().deleteToBeginningOfWord()
'editor:delete-to-beginning-of-line': -> @getModel().deleteToBeginningOfLine()
'editor:delete-to-end-of-line': -> @getModel().deleteToEndOfLine()
'editor:delete-to-end-of-word': -> @getModel().deleteToEndOfWord()
'editor:delete-line': -> @getModel().deleteLine()
'editor:cut-to-end-of-line': -> @getModel().cutToEndOfLine()
'editor:move-to-beginning-of-next-paragraph': -> @getModel().moveToBeginningOfNextParagraph()
'editor:move-to-beginning-of-previous-paragraph': -> @getModel().moveToBeginningOfPreviousParagraph()
'editor:move-to-beginning-of-screen-line': -> @getModel().moveToBeginningOfScreenLine()
'editor:move-to-beginning-of-line': -> @getModel().moveToBeginningOfLine()
'editor:move-to-end-of-screen-line': -> @getModel().moveToEndOfScreenLine()
'editor:move-to-end-of-line': -> @getModel().moveToEndOfLine()
'editor:move-to-first-character-of-line': -> @getModel().moveToFirstCharacterOfLine()
'editor:move-to-beginning-of-word': -> @getModel().moveToBeginningOfWord()
'editor:move-to-end-of-word': -> @getModel().moveToEndOfWord()
'editor:move-to-beginning-of-next-word': -> @getModel().moveToBeginningOfNextWord()
'editor:move-to-previous-word-boundary': -> @getModel().moveToPreviousWordBoundary()
'editor:move-to-next-word-boundary': -> @getModel().moveToNextWordBoundary()
'editor:select-to-beginning-of-next-paragraph': -> @getModel().selectToBeginningOfNextParagraph()
'editor:select-to-beginning-of-previous-paragraph': -> @getModel().selectToBeginningOfPreviousParagraph()
'editor:select-to-end-of-line': -> @getModel().selectToEndOfLine()
'editor:select-to-beginning-of-line': -> @getModel().selectToBeginningOfLine()
'editor:select-to-end-of-word': -> @getModel().selectToEndOfWord()
'editor:select-to-beginning-of-word': -> @getModel().selectToBeginningOfWord()
'editor:select-to-beginning-of-next-word': -> @getModel().selectToBeginningOfNextWord()
'editor:select-to-next-word-boundary': -> @getModel().selectToNextWordBoundary()
'editor:select-to-previous-word-boundary': -> @getModel().selectToPreviousWordBoundary()
'editor:select-to-first-character-of-line': -> @getModel().selectToFirstCharacterOfLine()
'editor:select-line': -> @getModel().selectLinesContainingCursors()
'editor:transpose': -> @getModel().transpose()
'editor:upper-case': -> @getModel().upperCase()
'editor:lower-case': -> @getModel().lowerCase()
stopEventPropagationAndGroupUndo = (commandListeners) ->
newCommandListeners = {}
for commandName, commandListener of commandListeners
do (commandListener) ->
newCommandListeners[commandName] = (event) ->
event.stopPropagation()
model = @getModel()
model.transact atom.config.get('editor.undoGroupingInterval'), ->
commandListener.call(model, event)
newCommandListeners
atom.commands.add 'atom-text-editor', stopEventPropagation(
'core:undo': -> @undo()
'core:redo': -> @redo()
)
atom.commands.add 'atom-text-editor:not(.mini)', stopCommandEventPropagation(
'core:move-up': -> @getModel().moveUp()
'core:move-down': -> @getModel().moveDown()
'core:move-to-top': -> @getModel().moveToTop()
'core:move-to-bottom': -> @getModel().moveToBottom()
'core:page-up': -> @getModel().pageUp()
'core:page-down': -> @getModel().pageDown()
'core:select-up': -> @getModel().selectUp()
'core:select-down': -> @getModel().selectDown()
'core:select-to-top': -> @getModel().selectToTop()
'core:select-to-bottom': -> @getModel().selectToBottom()
'core:select-page-up': -> @getModel().selectPageUp()
'core:select-page-down': -> @getModel().selectPageDown()
'editor:indent': -> @getModel().indent()
'editor:auto-indent': -> @getModel().autoIndentSelectedRows()
'editor:indent-selected-rows': -> @getModel().indentSelectedRows()
'editor:outdent-selected-rows': -> @getModel().outdentSelectedRows()
'editor:newline': -> @getModel().insertNewline()
'editor:newline-below': -> @getModel().insertNewlineBelow()
'editor:newline-above': -> @getModel().insertNewlineAbove()
'editor:add-selection-below': -> @getModel().addSelectionBelow()
'editor:add-selection-above': -> @getModel().addSelectionAbove()
'editor:split-selections-into-lines': -> @getModel().splitSelectionsIntoLines()
'editor:toggle-soft-tabs': -> @getModel().toggleSoftTabs()
'editor:toggle-soft-wrap': -> @getModel().toggleSoftWrapped()
'editor:fold-all': -> @getModel().foldAll()
'editor:unfold-all': -> @getModel().unfoldAll()
'editor:fold-current-row': -> @getModel().foldCurrentRow()
'editor:unfold-current-row': -> @getModel().unfoldCurrentRow()
'editor:fold-selection': -> @getModel().foldSelectedLines()
'editor:fold-at-indent-level-1': -> @getModel().foldAllAtIndentLevel(0)
'editor:fold-at-indent-level-2': -> @getModel().foldAllAtIndentLevel(1)
'editor:fold-at-indent-level-3': -> @getModel().foldAllAtIndentLevel(2)
'editor:fold-at-indent-level-4': -> @getModel().foldAllAtIndentLevel(3)
'editor:fold-at-indent-level-5': -> @getModel().foldAllAtIndentLevel(4)
'editor:fold-at-indent-level-6': -> @getModel().foldAllAtIndentLevel(5)
'editor:fold-at-indent-level-7': -> @getModel().foldAllAtIndentLevel(6)
'editor:fold-at-indent-level-8': -> @getModel().foldAllAtIndentLevel(7)
'editor:fold-at-indent-level-9': -> @getModel().foldAllAtIndentLevel(8)
'editor:toggle-line-comments': -> @getModel().toggleLineCommentsInSelection()
'editor:log-cursor-scope': -> @getModel().logCursorScope()
'editor:checkout-head-revision': -> atom.project.getRepositories()[0]?.checkoutHeadForEditor(@getModel())
'editor:copy-path': -> @getModel().copyPathToClipboard()
'editor:move-line-up': -> @getModel().moveLineUp()
'editor:move-line-down': -> @getModel().moveLineDown()
'editor:duplicate-lines': -> @getModel().duplicateLines()
'editor:join-lines': -> @getModel().joinLines()
atom.commands.add 'atom-text-editor', stopEventPropagationAndGroupUndo(
'core:move-left': -> @moveLeft()
'core:move-right': -> @moveRight()
'core:select-left': -> @selectLeft()
'core:select-right': -> @selectRight()
'core:select-all': -> @selectAll()
'core:backspace': -> @backspace()
'core:delete': -> @delete()
'core:cut': -> @cutSelectedText()
'core:copy': -> @copySelectedText()
'core:paste': -> @pasteText()
'editor:move-to-previous-word': -> @moveToPreviousWord()
'editor:select-word': -> @selectWordsContainingCursors()
'editor:consolidate-selections': (event) -> event.abortKeyBinding() unless @consolidateSelections()
'editor:delete-to-beginning-of-word': -> @deleteToBeginningOfWord()
'editor:delete-to-beginning-of-line': -> @deleteToBeginningOfLine()
'editor:delete-to-end-of-line': -> @deleteToEndOfLine()
'editor:delete-to-end-of-word': -> @deleteToEndOfWord()
'editor:delete-line': -> @deleteLine()
'editor:cut-to-end-of-line': -> @cutToEndOfLine()
'editor:move-to-beginning-of-next-paragraph': -> @moveToBeginningOfNextParagraph()
'editor:move-to-beginning-of-previous-paragraph': -> @moveToBeginningOfPreviousParagraph()
'editor:move-to-beginning-of-screen-line': -> @moveToBeginningOfScreenLine()
'editor:move-to-beginning-of-line': -> @moveToBeginningOfLine()
'editor:move-to-end-of-screen-line': -> @moveToEndOfScreenLine()
'editor:move-to-end-of-line': -> @moveToEndOfLine()
'editor:move-to-first-character-of-line': -> @moveToFirstCharacterOfLine()
'editor:move-to-beginning-of-word': -> @moveToBeginningOfWord()
'editor:move-to-end-of-word': -> @moveToEndOfWord()
'editor:move-to-beginning-of-next-word': -> @moveToBeginningOfNextWord()
'editor:move-to-previous-word-boundary': -> @moveToPreviousWordBoundary()
'editor:move-to-next-word-boundary': -> @moveToNextWordBoundary()
'editor:select-to-beginning-of-next-paragraph': -> @selectToBeginningOfNextParagraph()
'editor:select-to-beginning-of-previous-paragraph': -> @selectToBeginningOfPreviousParagraph()
'editor:select-to-end-of-line': -> @selectToEndOfLine()
'editor:select-to-beginning-of-line': -> @selectToBeginningOfLine()
'editor:select-to-end-of-word': -> @selectToEndOfWord()
'editor:select-to-beginning-of-word': -> @selectToBeginningOfWord()
'editor:select-to-beginning-of-next-word': -> @selectToBeginningOfNextWord()
'editor:select-to-next-word-boundary': -> @selectToNextWordBoundary()
'editor:select-to-previous-word-boundary': -> @selectToPreviousWordBoundary()
'editor:select-to-first-character-of-line': -> @selectToFirstCharacterOfLine()
'editor:select-line': -> @selectLinesContainingCursors()
'editor:transpose': -> @transpose()
'editor:upper-case': -> @upperCase()
'editor:lower-case': -> @lowerCase()
)
atom.commands.add 'atom-text-editor:not(.mini)', stopEventPropagationAndGroupUndo(
'core:move-up': -> @moveUp()
'core:move-down': -> @moveDown()
'core:move-to-top': -> @moveToTop()
'core:move-to-bottom': -> @moveToBottom()
'core:page-up': -> @pageUp()
'core:page-down': -> @pageDown()
'core:select-up': -> @selectUp()
'core:select-down': -> @selectDown()
'core:select-to-top': -> @selectToTop()
'core:select-to-bottom': -> @selectToBottom()
'core:select-page-up': -> @selectPageUp()
'core:select-page-down': -> @selectPageDown()
'editor:indent': -> @indent()
'editor:auto-indent': -> @autoIndentSelectedRows()
'editor:indent-selected-rows': -> @indentSelectedRows()
'editor:outdent-selected-rows': -> @outdentSelectedRows()
'editor:newline': -> @insertNewline()
'editor:newline-below': -> @insertNewlineBelow()
'editor:newline-above': -> @insertNewlineAbove()
'editor:add-selection-below': -> @addSelectionBelow()
'editor:add-selection-above': -> @addSelectionAbove()
'editor:split-selections-into-lines': -> @splitSelectionsIntoLines()
'editor:toggle-soft-tabs': -> @toggleSoftTabs()
'editor:toggle-soft-wrap': -> @toggleSoftWrapped()
'editor:fold-all': -> @foldAll()
'editor:unfold-all': -> @unfoldAll()
'editor:fold-current-row': -> @foldCurrentRow()
'editor:unfold-current-row': -> @unfoldCurrentRow()
'editor:fold-selection': -> @foldSelectedLines()
'editor:fold-at-indent-level-1': -> @foldAllAtIndentLevel(0)
'editor:fold-at-indent-level-2': -> @foldAllAtIndentLevel(1)
'editor:fold-at-indent-level-3': -> @foldAllAtIndentLevel(2)
'editor:fold-at-indent-level-4': -> @foldAllAtIndentLevel(3)
'editor:fold-at-indent-level-5': -> @foldAllAtIndentLevel(4)
'editor:fold-at-indent-level-6': -> @foldAllAtIndentLevel(5)
'editor:fold-at-indent-level-7': -> @foldAllAtIndentLevel(6)
'editor:fold-at-indent-level-8': -> @foldAllAtIndentLevel(7)
'editor:fold-at-indent-level-9': -> @foldAllAtIndentLevel(8)
'editor:toggle-line-comments': -> @toggleLineCommentsInSelection()
'editor:log-cursor-scope': -> @logCursorScope()
'editor:checkout-head-revision': -> atom.project.getRepositories()[0]?.checkoutHeadForEditor(this)
'editor:copy-path': -> @copyPathToClipboard()
'editor:move-line-up': -> @moveLineUp()
'editor:move-line-down': -> @moveLineDown()
'editor:duplicate-lines': -> @duplicateLines()
'editor:join-lines': -> @joinLines()
'editor:toggle-indent-guide': -> atom.config.set('editor.showIndentGuide', not atom.config.get('editor.showIndentGuide'))
'editor:toggle-line-numbers': -> atom.config.set('editor.showLineNumbers', not atom.config.get('editor.showLineNumbers'))
'editor:scroll-to-cursor': -> @getModel().scrollToCursorPosition()
'editor:scroll-to-cursor': -> @scrollToCursorPosition()
)
module.exports = TextEditorElement = document.registerElement 'atom-text-editor', prototype: TextEditorElement.prototype
+27 -7
Ver Arquivo
@@ -73,13 +73,26 @@ class TextEditorView extends View
setModel: (@model) ->
@editor = @model
@scrollView = @find('.scroll-view')
@underlayer = @find('.highlights').addClass('underlayer')
@overlayer = @find('.lines').addClass('overlayer')
@hiddenInput = @.find('.hidden-input')
@root = $(@element.rootElement)
@scrollView = @root.find('.scroll-view')
if atom.config.get('editor.useShadowDOM')
@underlayer = $("<div class='underlayer'></div>").appendTo(this)
@overlayer = $("<div class='overlayer'></div>").appendTo(this)
else
@underlayer = @find('.highlights').addClass('underlayer')
@overlayer = @find('.lines').addClass('overlayer')
@hiddenInput = @root.find('.hidden-input')
@hiddenInput.on = (args...) =>
args[0] = 'blur' if args[0] is 'focusout'
$::on.apply(this, args)
@subscribe atom.config.observe 'editor.showLineNumbers', =>
@gutter = @find('.gutter')
@gutter = @root.find('.gutter')
@gutter.removeClassFromAllLines = (klass) =>
deprecate('Use decorations instead: http://blog.atom.io/2014/07/24/decorations.html')
@@ -95,6 +108,13 @@ class TextEditorView extends View
lines.addClass(klass)
lines.length > 0
find: ->
shadowResult = @root.find.apply(@root, arguments)
if shadowResult.length > 0
shadowResult
else
super
# Public: Get the underlying editor model for this view.
#
# Returns an {TextEditor}
@@ -107,7 +127,7 @@ class TextEditorView extends View
Object.defineProperty @::, 'firstRenderedScreenRow', get: -> @component.getRenderedRowRange()[0]
Object.defineProperty @::, 'lastRenderedScreenRow', get: -> @component.getRenderedRowRange()[1]
Object.defineProperty @::, 'active', get: -> @is(@getPaneView()?.activeView)
Object.defineProperty @::, 'isFocused', get: -> @component?.state.focused
Object.defineProperty @::, 'isFocused', get: -> document.activeElement is @element or document.activeElement is @element.component?.refs.input.getDOMNode()
Object.defineProperty @::, 'mini', get: -> @component?.props.mini
Object.defineProperty @::, 'component', get: -> @element?.component
@@ -164,7 +184,7 @@ class TextEditorView extends View
appendToLinesView: (view) ->
view.css('position', 'absolute')
view.css('z-index', 1)
@find('.lines').prepend(view)
@overlayer.append(view)
unmountComponent: ->
React.unmountComponentAtNode(@element) if @component.isMounted()
+37 -4
Ver Arquivo
@@ -134,9 +134,11 @@ class TextEditor extends Model
@emitter.emit 'did-change-title', @getTitle()
@emit "path-changed"
@emitter.emit 'did-change-path', @getPath()
@subscribe @buffer.onDidChangeEncoding =>
@emitter.emit 'did-change-encoding', @getEncoding()
@subscribe @buffer.onDidDestroy => @destroy()
# TODO: remove these thwne we remove the deprecations. They are old events.
# TODO: remove these when we remove the deprecations. They are old events.
@subscribe @buffer.onDidStopChanging => @emit "contents-modified"
@subscribe @buffer.onDidConflict => @emit "contents-conflicted"
@subscribe @buffer.onDidChangeModified => @emit "modified-status-changed"
@@ -173,6 +175,7 @@ class TextEditor extends Model
destroyed: ->
@unsubscribe()
@scopedConfigSubscriptions.dispose()
selection.destroy() for selection in @getSelections()
@buffer.release()
@displayBuffer.destroy()
@@ -260,6 +263,14 @@ class TextEditor extends Model
onDidChangeSoftWrapped: (callback) ->
@displayBuffer.onDidChangeSoftWrapped(callback)
# Extended: Calls your `callback` when the buffer's encoding has changed.
#
# * `callback` {Function}
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidChangeEncoding: (callback) ->
@emitter.on 'did-change-encoding', callback
# Extended: Calls your `callback` when the grammar that interprets and
# colorizes the text has been changed. Immediately calls your callback with
# the current grammar.
@@ -568,6 +579,16 @@ class TextEditor extends Model
# Essential: Returns the {String} path of this editor's text buffer.
getPath: -> @buffer.getPath()
# Extended: Returns the {String} character set encoding of this editor's text
# buffer.
getEncoding: -> @buffer.getEncoding()
# Extended: Set the character set encoding to use in this editor's text
# buffer.
#
# * `encoding` The {String} character set encoding name such as 'utf8'
setEncoding: (encoding) -> @buffer.setEncoding(encoding)
# Essential: Returns {Boolean} `true` if this editor has been modified.
isModified: -> @buffer.isModified()
@@ -717,9 +738,12 @@ class TextEditor extends Model
#
# * `range` A {Range} or range-compatible {Array}.
# * `text` A {String}
# * `options` (optional) {Object}
# * `normalizeLineEndings` (optional) {Boolean} (default: true)
# * `undo` (optional) {String} 'skip' will skip the undo system
#
# Returns the {Range} of the newly-inserted text.
setTextInBufferRange: (range, text, normalizeLineEndings) -> @getBuffer().setTextInRange(range, text, normalizeLineEndings)
setTextInBufferRange: (range, text, options) -> @getBuffer().setTextInRange(range, text, options)
# Essential: For each selection, replace the selected text with the given text.
#
@@ -1073,8 +1097,10 @@ class TextEditor extends Model
# abort the transaction, call {::abortTransaction} to terminate the function's
# execution and revert any changes performed up to the abortion.
#
# * `groupingInterval` (optional) This is the sames as the `groupingInterval`
# parameter in {::beginTransaction}
# * `fn` A {Function} to call inside the transaction.
transact: (fn) -> @buffer.transact(fn)
transact: (groupingInterval, fn) -> @buffer.transact(groupingInterval, fn)
# Extended: Start an open-ended transaction.
#
@@ -1082,7 +1108,12 @@ class TextEditor extends Model
# transaction. If you nest calls to transactions, only the outermost
# transaction is considered. You must match every begin with a matching
# commit, but a single call to abort will cancel all nested transactions.
beginTransaction: -> @buffer.beginTransaction()
#
# * `groupingInterval` (optional) The {Number} of milliseconds for which this
# transaction should be considered 'groupable' after it begins. If a transaction
# with a positive `groupingInterval` is committed while the previous transaction is
# still 'groupable', the two transactions are merged with respect to undo and redo.
beginTransaction: (groupingInterval) -> @buffer.beginTransaction(groupingInterval)
# Extended: Commit an open-ended transaction started with {::beginTransaction}
# and push it to the undo stack.
@@ -2432,6 +2463,7 @@ class TextEditor extends Model
copySelectedText: ->
maintainClipboard = false
for selection in @getSelections()
selection.selectLine() if selection.isEmpty()
selection.copy(maintainClipboard)
maintainClipboard = true
@@ -2439,6 +2471,7 @@ class TextEditor extends Model
cutSelectedText: ->
maintainClipboard = false
@mutateSelectedText (selection) ->
selection.selectLine() if selection.isEmpty()
selection.cut(maintainClipboard)
maintainClipboard = true
+34 -29
Ver Arquivo
@@ -1,56 +1,61 @@
isHighSurrogate = (string, index) ->
0xD800 <= string.charCodeAt(index) <= 0xDBFF
isHighSurrogate = (charCode) ->
0xD800 <= charCode <= 0xDBFF
isLowSurrogate = (string, index) ->
0xDC00 <= string.charCodeAt(index) <= 0xDFFF
isLowSurrogate = (charCode) ->
0xDC00 <= charCode <= 0xDFFF
isVariationSelector = (string, index) ->
0xFE00 <= string.charCodeAt(index) <= 0xFE0F
isVariationSelector = (charCode) ->
0xFE00 <= charCode <= 0xFE0F
isCombiningCharacter = (string, index) ->
0x0300 <= string.charCodeAt(index) <= 0x036F or
0x1AB0 <= string.charCodeAt(index) <= 0x1AFF or
0x1DC0 <= string.charCodeAt(index) <= 0x1DFF or
0x20D0 <= string.charCodeAt(index) <= 0x20FF or
0xFE20 <= string.charCodeAt(index) <= 0xFE2F
isCombiningCharacter = (charCode) ->
0x0300 <= charCode <= 0x036F or
0x1AB0 <= charCode <= 0x1AFF or
0x1DC0 <= charCode <= 0x1DFF or
0x20D0 <= charCode <= 0x20FF or
0xFE20 <= charCode <= 0xFE2F
# Is the character at the given index the start of a high/low surrogate pair?
# Are the given character codes a high/low surrogate pair?
#
# * `string` The {String} to check for a surrogate pair.
# * `index` The {Number} index to look for a surrogate pair at.
# * `charCodeA` The first character code {Number}.
# * `charCode2` The second character code {Number}.
#
# Return a {Boolean}.
isSurrogatePair = (string, index=0) ->
isHighSurrogate(string, index) and isLowSurrogate(string, index + 1)
isSurrogatePair = (charCodeA, charCodeB) ->
isHighSurrogate(charCodeA) and isLowSurrogate(charCodeB)
# Is the character at the given index the start of a variation sequence?
# Are the given character codes a variation sequence?
#
# * `string` The {String} to check for a variation sequence.
# * `index` The {Number} index to look for a variation sequence at.
# * `charCodeA` The first character code {Number}.
# * `charCode2` The second character code {Number}.
#
# Return a {Boolean}.
isVariationSequence = (string, index=0) ->
not isVariationSelector(string, index) and isVariationSelector(string, index + 1)
isVariationSequence = (charCodeA, charCodeB) ->
not isVariationSelector(charCodeA) and isVariationSelector(charCodeB)
# Is the character at the given index the start of a combined character pair?
# Are the given character codes a combined character pair?
#
# * `string` The {String} to check for a combined character.
# * `index` The {Number} index to look for a variation sequence at.
# * `charCodeA` The first character code {Number}.
# * `charCode2` The second character code {Number}.
#
# Return a {Boolean}.
isCombinedCharacter = (string, index=0) ->
not isCombiningCharacter(string, index) and isCombiningCharacter(string, index + 1)
isCombinedCharacter = (charCodeA, charCodeB) ->
not isCombiningCharacter(charCodeA) and isCombiningCharacter(charCodeB)
# Is the character at the given index the start of high/low surrogate pair
# a variation sequence, or a combined character?
#
# * `string` The {String} to check for a surrogate pair, variation sequence,
# or combined character.
# * `index` The {Number} index to look for a surrogate pair at.
# * `index` The {Number} index to look for a surrogate pair, variation
# sequence, or combined character.
#
# Return a {Boolean}.
isPairedCharacter = (string, index=0) ->
isSurrogatePair(string, index) or isVariationSequence(string, index) or isCombinedCharacter(string, index)
charCodeA = string.charCodeAt(index)
charCodeB = string.charCodeAt(index + 1)
isSurrogatePair(charCodeA, charCodeB) or
isVariationSequence(charCodeA, charCodeB) or
isCombinedCharacter(charCodeA, charCodeB)
# Does the given string contain at least surrogate pair, variation sequence,
# or combined character?
+11 -5
Ver Arquivo
@@ -159,11 +159,14 @@ class ThemeManager
themeNames = atom.config.get('core.themes') ? []
themeNames = [themeNames] unless _.isArray(themeNames)
themeNames = themeNames.filter (themeName) ->
themeName and typeof themeName is 'string'
if themeName and typeof themeName is 'string'
return true if atom.packages.resolvePackagePath(themeName)
console.warn("Enabled theme '#{themeName}' is not installed.")
false
# Use a built-in syntax and UI theme when in safe mode since themes
# installed to ~/.atom/packages will not be loaded.
if @safeMode
# Use a built-in syntax and UI theme any time the configured themes are not
# available.
if themeNames.length < 2
builtInThemeNames = [
'atom-dark-syntax'
'atom-dark-ui'
@@ -238,7 +241,7 @@ class ThemeManager
@applyStylesheet(userStylesheetPath, userStylesheetContents, 'userTheme')
loadBaseStylesheets: ->
@requireStylesheet('bootstrap/less/bootstrap')
@requireStylesheet('../static/bootstrap')
@reloadBaseStylesheets()
reloadBaseStylesheets: ->
@@ -246,6 +249,9 @@ class ThemeManager
if nativeStylesheetPath = fs.resolveOnLoadPath(process.platform, ['css', 'less'])
@requireStylesheet(nativeStylesheetPath)
textEditorStylesPath = path.join(@resourcePath, 'static', 'text-editor-shadow.less')
atom.styles.addStyleSheet(@loadLessStylesheet(textEditorStylesPath), sourcePath: textEditorStylesPath, context: 'atom-text-editor')
stylesheetElementForId: (id) ->
document.head.querySelector("atom-styles style[source-path=\"#{id}\"]")
+3 -2
Ver Arquivo
@@ -21,10 +21,10 @@ class Token
firstTrailingWhitespaceIndex: null
hasInvisibleCharacters: false
constructor: ({@value, @scopes, @isAtomic, @bufferDelta, @isHardTab}) ->
constructor: ({@value, @scopes, @isAtomic, @bufferDelta, @isHardTab, @hasPairedCharacter}) ->
@screenDelta = @value.length
@bufferDelta ?= @screenDelta
@hasPairedCharacter = textUtils.hasPairedCharacter(@value)
@hasPairedCharacter ?= textUtils.hasPairedCharacter(@value)
isEqual: (other) ->
# TODO: scopes is deprecated. This is here for the sake of lang package tests
@@ -125,6 +125,7 @@ class Token
value: value[index..index + 1]
scopes: @scopes
isAtomic: true
hasPairedCharacter: true
)
buildHardTabToken: (tabLength, column) ->
+4 -1
Ver Arquivo
@@ -125,7 +125,10 @@ class TokenizedBuffer extends Model
getTabLength: ->
@tabLength ? @configSettings.tabLength
setTabLength: (@tabLength) ->
setTabLength: (tabLength) ->
return if tabLength is @tabLength
@tabLength = tabLength
@retokenizeLines()
setInvisibles: (invisibles) ->
+101 -2
Ver Arquivo
@@ -1,17 +1,116 @@
{Disposable} = require 'event-kit'
{jQuery} = require './space-pen-extensions'
# Essential: `ViewRegistry` handles the association between model and view
# types in Atom. We call this association a View Provider. As in, for a given
# model, this class can provide a view via {::getView}, as long as the
# model/view association was registered via {::addViewProvider}
#
# If you're adding your own kind of pane item, a good strategy for all but the
# simplest items is to separate the model and the view. The model handles
# application logic and is the primary point of API interaction. The view
# just handles presentation.
#
# View providers to inform the workspace how your model objects should be
# presented in the DOM. A view provider must always return a DOM node, which
# makes [HTML 5 custom elements](http://www.html5rocks.com/en/tutorials/webcomponents/customelements/)
# an ideal tool for implementing views in Atom.
#
# You can access the `ViewRegistry` object via `atom.views`.
#
# ## Examples
#
# ### Getting the workspace element
#
# ```coffee
# workspaceElement = atom.views.getView(atom.workspace)
# ```
#
# ### Getting An Editor Element
#
# ```coffee
# textEditor = atom.workspace.getActiveTextEditor()
# textEditorElement = atom.views.getView(textEditor)
# ```
#
# ### Getting A Pane Element
#
# ```coffee
# pane = atom.workspace.getActivePane()
# paneElement = atom.views.getView(pane)
# ```
module.exports =
class ViewRegistry
constructor: ->
@views = new WeakMap
@providers = []
# Essential: Add a provider that will be used to construct views in the
# workspace's view layer based on model objects in its model layer.
#
# ## Examples
#
# Text editors are divided into a model and a view layer, so when you interact
# with methods like `atom.workspace.getActiveTextEditor()` you're only going
# to get the model object. We display text editors on screen by teaching the
# workspace what view constructor it should use to represent them:
#
# ```coffee
# atom.views.addViewProvider
# modelConstructor: TextEditor
# viewConstructor: TextEditorElement
# ```
#
# * `providerSpec` {Object} containing the following keys:
# * `modelConstructor` Constructor {Function} for your model.
# * `viewConstructor` (Optional) Constructor {Function} for your view. It
# should be a subclass of `HTMLElement` (that is, your view should be a
# DOM node) and have a `::setModel()` method which will be called
# immediately after construction. If you don't supply this property, you
# must supply the `createView` property with a function that never returns
# `undefined`.
# * `createView` (Optional) Factory {Function} that must return a subclass
# of `HTMLElement` or `undefined`. If this property is not present or the
# function returns `undefined`, the view provider will fall back to the
# `viewConstructor` property. If you don't provide this property, you must
# provider a `viewConstructor` property.
#
# Returns a {Disposable} on which `.dispose()` can be called to remove the
# added provider.
addViewProvider: (providerSpec) ->
@providers.push(providerSpec)
new Disposable =>
@providers = @providers.filter (provider) -> provider isnt providerSpec
# Essential: Get the view associated with an object in the workspace.
#
# If you're just *using* the workspace, you shouldn't need to access the view
# layer, but view layer access may be necessary if you want to perform DOM
# manipulation that isn't supported via the model API.
#
# ## Examples
#
# ### Getting An Editor View
# ```coffee
# textEditor = atom.workspace.getActiveTextEditor()
# textEditorView = atom.views.getView(textEditor)
# ```
#
# ### Getting A Pane View
# ```coffee
# pane = atom.workspace.getActivePane()
# paneView = atom.views.getView(pane)
# ```
#
# ### Getting The Workspace View
#
# ```coffee
# workspaceView = atom.views.getView(atom.workspace)
# ```
#
# * `object` The object for which you want to retrieve a view. This can be a
# pane item, a pane, or the workspace itself.
#
# Returns a DOM element.
getView: (object) ->
return unless object?
@@ -25,7 +124,7 @@ class ViewRegistry
createView: (object) ->
if object instanceof HTMLElement
object
else if object instanceof jQuery
else if object?.jquery
object[0]?.__spacePenView ?= object
object[0]
else if provider = @findProvider(object)
+1 -1
Ver Arquivo
@@ -28,7 +28,7 @@ class WindowEventHandler
@subscribe $(window), 'blur', -> document.body.classList.add('is-blurred')
@subscribe $(window), 'window:open-path', (event, {pathToOpen, initialLine, initialColumn}) ->
@subscribeToCommand $(window), 'window:open-path', (event, {pathToOpen, initialLine, initialColumn}) ->
unless atom.project?.getPath()
if fs.existsSync(pathToOpen) or fs.existsSync(path.dirname(pathToOpen))
atom.project?.setPath(pathToOpen)
+5 -8
Ver Arquivo
@@ -23,6 +23,7 @@ class WorkspaceElement extends HTMLElement
@focus()
detachedCallback: ->
@subscriptions.dispose()
@model.destroy()
initializeGlobalTextEditorStyleSheet: ->
@@ -64,19 +65,16 @@ class WorkspaceElement extends HTMLElement
getModel: -> @model
setModel: (@model) ->
@paneContainer = @model.getView(@model.paneContainer)
@paneContainer = atom.views.getView(@model.paneContainer)
@verticalAxis.appendChild(@paneContainer)
@addEventListener 'focus', @handleFocus.bind(this)
handleWindowFocus = @handleWindowFocus.bind(this)
window.addEventListener 'focus', handleWindowFocus
@subscriptions.add(new Disposable -> window.removeEventListener 'focus', handleWindowFocus)
@panelContainers =
top: @model.panelContainers.top.getView()
left: @model.panelContainers.left.getView()
right: @model.panelContainers.right.getView()
bottom: @model.panelContainers.bottom.getView()
modal: @model.panelContainers.modal.getView()
@horizontalAxis.insertBefore(@panelContainers.left, @verticalAxis)
@horizontalAxis.appendChild(@panelContainers.right)
@@ -84,6 +82,8 @@ class WorkspaceElement extends HTMLElement
@verticalAxis.insertBefore(@panelContainers.top, @paneContainer)
@verticalAxis.appendChild(@panelContainers.bottom)
@appendChild(@panelContainers.modal)
@__spacePenView.setModel(@model)
setTextEditorFontSize: (fontSize) ->
@@ -103,9 +103,6 @@ class WorkspaceElement extends HTMLElement
handleFocus: (event) ->
@model.getActivePane().activate()
handleWindowFocus: (event) ->
@handleFocus(event) if document.activeElement is document.body
focusPaneViewAbove: -> @paneContainer.focusPaneViewAbove()
focusPaneViewBelow: -> @paneContainer.focusPaneViewBelow()
+1 -1
Ver Arquivo
@@ -59,7 +59,7 @@ class WorkspaceView extends View
constructor: (@element) ->
unless @element?
return atom.workspace.getView(atom.workspace).__spacePenView
return atom.views.getView(atom.workspace).__spacePenView
super
@deprecateViewEvents()
+47 -104
Ver Arquivo
@@ -45,15 +45,16 @@ class Workspace extends Model
@emitter = new Emitter
@openers = []
@viewRegistry ?= new ViewRegistry
@paneContainer ?= new PaneContainer({@viewRegistry})
viewRegistry = atom.views
@paneContainer ?= new PaneContainer({viewRegistry})
@paneContainer.onDidDestroyPaneItem(@onPaneItemDestroyed)
@panelContainers =
top: new PanelContainer({@viewRegistry, location: 'top'})
left: new PanelContainer({@viewRegistry, location: 'left'})
right: new PanelContainer({@viewRegistry, location: 'right'})
bottom: new PanelContainer({@viewRegistry, location: 'bottom'})
top: new PanelContainer({viewRegistry, location: 'top'})
left: new PanelContainer({viewRegistry, location: 'left'})
right: new PanelContainer({viewRegistry, location: 'right'})
bottom: new PanelContainer({viewRegistry, location: 'bottom'})
modal: new PanelContainer({viewRegistry, location: 'modal'})
@subscribeToActiveItem()
@@ -68,15 +69,15 @@ class Workspace extends Model
when 'atom://.atom/init-script'
@open(atom.getUserInitScriptPath())
@addViewProvider
atom.views.addViewProvider
modelConstructor: Workspace
viewConstructor: WorkspaceElement
@addViewProvider
atom.views.addViewProvider
modelConstructor: PanelContainer
viewConstructor: PanelContainerElement
@addViewProvider
atom.views.addViewProvider
modelConstructor: Panel
viewConstructor: PanelElement
@@ -85,8 +86,7 @@ class Workspace extends Model
for packageName in params.packagesWithActiveGrammars ? []
atom.packages.getLoadedPackage(packageName)?.loadGrammarsSync()
params.viewRegistry = new ViewRegistry
params.paneContainer.viewRegistry = params.viewRegistry
params.paneContainer.viewRegistry = atom.views
params.paneContainer = PaneContainer.deserialize(params.paneContainer)
params
@@ -315,7 +315,7 @@ class Workspace extends Model
when 'editor-created'
deprecate("Use Workspace::onDidAddTextEditor or Workspace::observeTextEditors instead.")
when 'uri-opened'
deprecate("Use Workspace::onDidAddPaneItem instead.")
deprecate("Use Workspace::onDidOpen or Workspace::onDidAddPaneItem instead. https://atom.io/docs/api/latest/Workspace#instance-onDidOpen")
else
deprecate("Subscribing via ::on is deprecated. Use documented event subscription methods instead.")
@@ -552,7 +552,7 @@ class Workspace extends Model
activatePreviousPane: ->
@paneContainer.activatePreviousPane()
# Extended: Get the first pane {Pane} with an item for the given URI.
# Extended: Get the first {Pane} with an item for the given URI.
#
# * `uri` {String} uri
#
@@ -560,6 +560,14 @@ class Workspace extends Model
paneForUri: (uri) ->
@paneContainer.paneForUri(uri)
# Extended: Get the {Pane} containing the given item.
#
# * `item` Item the returned pane contains.
#
# Returns a {Pane} or `undefined` if no pane exists for the given item.
paneForItem: (item) ->
@paneContainer.paneForItem(item)
# Destroy (close) the active pane.
destroyActivePane: ->
@activePane?.destroy()
@@ -605,8 +613,8 @@ class Workspace extends Model
#
# * `options` {Object}
# * `item` Your panel content. It can be DOM element, a jQuery element, or
# a model with a view registered via {::addViewProvider}. We recommend the
# latter. See {::addViewProvider} for more information.
# a model with a view registered via {ViewRegistry::addViewProvider}. We recommend the
# latter. See {ViewRegistry::addViewProvider} for more information.
# * `visible` (optional) {Boolean} false if you want the panel to initially be hidden
# (default: true)
# * `priority` (optional) {Number} Determines stacking order. Lower priority items are
@@ -620,8 +628,8 @@ class Workspace extends Model
#
# * `options` {Object}
# * `item` Your panel content. It can be DOM element, a jQuery element, or
# a model with a view registered via {::addViewProvider}. We recommend the
# latter. See {::addViewProvider} for more information.
# a model with a view registered via {ViewRegistry::addViewProvider}. We recommend the
# latter. See {ViewRegistry::addViewProvider} for more information.
# * `visible` (optional) {Boolean} false if you want the panel to initially be hidden
# (default: true)
# * `priority` (optional) {Number} Determines stacking order. Lower priority items are
@@ -635,8 +643,8 @@ class Workspace extends Model
#
# * `options` {Object}
# * `item` Your panel content. It can be DOM element, a jQuery element, or
# a model with a view registered via {::addViewProvider}. We recommend the
# latter. See {::addViewProvider} for more information.
# a model with a view registered via {ViewRegistry::addViewProvider}. We recommend the
# latter. See {ViewRegistry::addViewProvider} for more information.
# * `visible` (optional) {Boolean} false if you want the panel to initially be hidden
# (default: true)
# * `priority` (optional) {Number} Determines stacking order. Lower priority items are
@@ -650,8 +658,8 @@ class Workspace extends Model
#
# * `options` {Object}
# * `item` Your panel content. It can be DOM element, a jQuery element, or
# a model with a view registered via {::addViewProvider}. We recommend the
# latter. See {::addViewProvider} for more information.
# a model with a view registered via {ViewRegistry::addViewProvider}. We recommend the
# latter. See {ViewRegistry::addViewProvider} for more information.
# * `visible` (optional) {Boolean} false if you want the panel to initially be hidden
# (default: true)
# * `priority` (optional) {Number} Determines stacking order. Lower priority items are
@@ -661,89 +669,24 @@ class Workspace extends Model
addTopPanel: (options) ->
@addPanel('top', options)
# Essential: Adds a panel item as a modal dialog.
#
# * `options` {Object}
# * `item` Your panel content. It can be DOM element, a jQuery element, or
# a model with a view registered via {ViewRegistry::addViewProvider}. We recommend the
# latter. See {ViewRegistry::addViewProvider} for more information.
# * `visible` (optional) {Boolean} false if you want the panel to initially be hidden
# (default: true)
# * `priority` (optional) {Number} Determines stacking order. Lower priority items are
# forced closer to the edges of the window. (default: 100)
#
# Returns a {Panel}
addModalPanel: (options={}) ->
# TODO: remove these default classes. They are to supoprt existing themes.
options.className ?= 'overlay from-top'
@addPanel('modal', options)
addPanel: (location, options) ->
options ?= {}
options.viewRegistry = @viewRegistry
options.viewRegistry = atom.views
@panelContainers[location].addPanel(new Panel(options))
###
Section: View Management
###
# Essential: Get the view associated with an object in the workspace.
#
# If you're just *using* the workspace, you shouldn't need to access the view
# layer, but view layer access may be necessary if you want to perform DOM
# manipulation that isn't supported via the model API.
#
# ## Examples
#
# ### Getting An Editor View
# ```coffee
# textEditor = atom.workspace.getActiveTextEditor()
# textEditorView = atom.workspace.getView(textEditor)
# ```
#
# ### Getting A Pane View
# ```coffee
# pane = atom.workspace.getActivePane()
# paneView = atom.workspace.getView(pane)
# ```
#
# ### Getting The Workspace View
#
# ```coffee
# workspaceView = atom.workspace.getView(atom.workspace)
# ```
#
# * `object` The object for which you want to retrieve a view. This can be a
# pane item, a pane, or the workspace itself.
#
# Returns a DOM element.
getView: (object) ->
@viewRegistry.getView(object)
# Essential: Add a provider that will be used to construct views in the
# workspace's view layer based on model objects in its model layer.
#
# If you're adding your own kind of pane item, a good strategy for all but the
# simplest items is to separate the model and the view. The model handles
# application logic and is the primary point of API interaction. The view
# just handles presentation.
#
# Use view providers to inform the workspace how your model objects should be
# presented in the DOM. A view provider must always return a DOM node, which
# makes [HTML 5 custom elements](http://www.html5rocks.com/en/tutorials/webcomponents/customelements/)
# an ideal tool for implementing views in Atom.
#
# ## Examples
#
# Text editors are divided into a model and a view layer, so when you interact
# with methods like `atom.workspace.getActiveTextEditor()` you're only going
# to get the model object. We display text editors on screen by teaching the
# workspace what view constructor it should use to represent them:
#
# ```coffee
# atom.workspace.addViewProvider
# modelConstructor: TextEditor
# viewConstructor: TextEditorElement
# ```
#
# * `providerSpec` {Object} containing the following keys:
# * `modelConstructor` Constructor {Function} for your model.
# * `viewConstructor` (Optional) Constructor {Function} for your view. It
# should be a subclass of `HTMLElement` (that is, your view should be a
# DOM node) and have a `::setModel()` method which will be called
# immediately after construction. If you don't supply this property, you
# must supply the `createView` property with a function that never returns
# `undefined`.
# * `createView` (Optional) Factory {Function} that must return a subclass
# of `HTMLElement` or `undefined`. If this property is not present or the
# function returns `undefined`, the view provider will fall back to the
# `viewConstructor` property. If you don't provide this property, you must
# provider a `viewConstructor` property.
#
# Returns a {Disposable} on which `.dispose()` can be called to remove the
# added provider.
addViewProvider: (providerSpec) ->
@viewRegistry.addViewProvider(providerSpec)
+2 -3
Ver Arquivo
@@ -10,19 +10,18 @@
@import "octicon-mixins";
@import "workspace-view";
@import "bootstrap";
@import "bootstrap-overrides";
@import "buttons";
@import "icons";
@import "links";
@import "panes";
@import "panels";
@import "sections";
@import "overlay";
@import "lists";
@import "popover-list";
@import "messages";
@import "markdown";
@import "editor";
@import "text-editor-light";
@import "select-list";
@import "syntax";
@import "utilities";
+14
Ver Arquivo
@@ -0,0 +1,14 @@
@import "ui-variables";
.nav {
> li > a {
border-radius: @component-border-radius;
}
> li > a:hover {
background-color: @background-color-highlight;
}
&.nav-pills > li.active > a {
background-color: @background-color-selected;
}
}
+29 -12
Ver Arquivo
@@ -1,14 +1,31 @@
@import "ui-variables";
// Core variables and mixins
@import "../node_modules/bootstrap/less/variables.less";
@import "../node_modules/bootstrap/less/mixins.less";
.nav {
> li > a {
border-radius: @component-border-radius;
}
> li > a:hover {
background-color: @background-color-highlight;
}
// Reset
@import "../node_modules/bootstrap/less/normalize.less";
&.nav-pills > li.active > a {
background-color: @background-color-selected;
}
}
// Core CSS
@import "../node_modules/bootstrap/less/scaffolding.less";
@import "../node_modules/bootstrap/less/type.less";
@import "../node_modules/bootstrap/less/code.less";
@import "../node_modules/bootstrap/less/grid.less";
@import "../node_modules/bootstrap/less/tables.less";
@import "../node_modules/bootstrap/less/forms.less";
@import "../node_modules/bootstrap/less/buttons.less";
// Components
@import "../node_modules/bootstrap/less/button-groups.less";
@import "../node_modules/bootstrap/less/input-groups.less";
@import "../node_modules/bootstrap/less/navs.less";
@import "../node_modules/bootstrap/less/labels.less";
@import "../node_modules/bootstrap/less/badges.less";
@import "../node_modules/bootstrap/less/alerts.less";
@import "../node_modules/bootstrap/less/list-group.less";
@import "../node_modules/bootstrap/less/thumbnails.less";
// Components w/ JavaScript
@import "../node_modules/bootstrap/less/tooltip.less";
// Utility classes
@import "../node_modules/bootstrap/less/utilities.less";
-310
Ver Arquivo
@@ -1,310 +0,0 @@
@import "ui-variables";
@import "octicon-utf-codes";
@import "octicon-mixins";
atom-text-editor.react {
.editor-contents {
width: 100%;
}
.underlayer {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -2;
}
.lines {
min-width: 100%;
}
.cursor {
z-index: 4;
pointer-events: none;
}
.editor-contents.is-focused .cursor {
visibility: visible;
}
.cursors.blink-off .cursor {
opacity: 0;
}
.horizontal-scrollbar {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 15px;
overflow-x: auto;
overflow-y: hidden;
z-index: 3;
.scrollbar-content {
height: 15px;
}
}
.vertical-scrollbar {
overflow-x: hidden;
}
.scrollbar-corner {
position: absolute;
overflow: auto;
bottom: 0;
right: 0;
}
.scroll-view {
overflow: hidden;
z-index: 0;
}
.scroll-view-content {
position: relative;
width: 100%;
}
.gutter {
.line-number {
white-space: nowrap;
padding-left: .5em;
.icon-right {
padding: 0 .4em;
&:before {
text-align: center;
}
}
}
}
}
atom-text-editor.mini {
font-size: @input-font-size;
line-height: @component-line-height;
max-height: @component-line-height + 2; // +2 for borders
.placeholder-text {
position: absolute;
color: @text-color-subtle;
}
}
atom-text-editor {
z-index: 0;
font-family: Inconsolata, Monaco, Consolas, 'Courier New', Courier;
line-height: 1.3;
}
atom-text-editor, .editor-contents {
overflow: hidden;
cursor: text;
display: -webkit-flex;
-webkit-user-select: none;
position: relative;
}
atom-text-editor .gutter .line-number.cursor-line {
opacity: 1;
}
atom-text-editor .gutter {
overflow: hidden;
text-align: right;
cursor: default;
min-width: 1em;
box-sizing: border-box;
}
atom-text-editor .gutter .line-number {
padding-left: .5em;
opacity: 0.6;
}
atom-text-editor .gutter .line-numbers {
position: relative;
}
atom-text-editor .gutter .line-number.folded.cursor-line {
opacity: 1;
}
atom-text-editor .gutter .line-number .icon-right {
.octicon(chevron-down, 0.8em);
display: inline-block;
visibility: hidden;
padding-left: .1em;
padding-right: .5em;
opacity: .6;
}
atom-text-editor .gutter:hover .line-number.foldable .icon-right {
visibility: visible;
&:before {
content: @chevron-down;
}
&:hover {
opacity: 1;
}
}
atom-text-editor .gutter, atom-text-editor .gutter:hover {
.line-number.folded .icon-right {
.octicon(chevron-right, 0.8em);
visibility: visible;
&:before { // chevron-right renders too far right compared to chevron-down
position: relative;
left: -.1em;
content: @chevron-right;
}
}
}
atom-text-editor .fold-marker {
cursor: default;
}
atom-text-editor .fold-marker:after {
.icon(0.8em, inline);
content: @ellipsis;
padding-left: 0.2em;
}
atom-text-editor .line.cursor-line .fold-marker:after {
opacity: 1;
}
atom-text-editor.is-blurred .line.cursor-line {
background: rgba(0, 0, 0, 0);
}
atom-text-editor .invisible-character {
font-weight: normal !important;
font-style: normal !important;
}
atom-text-editor .indent-guide {
display: inline-block;
box-shadow: inset 1px 0;
}
atom-text-editor .vertical-scrollbar,
atom-text-editor .horizontal-scrollbar {
cursor: default;
}
atom-text-editor .vertical-scrollbar {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 15px;
overflow-y: auto;
z-index: 3;
}
atom-text-editor .scroll-view {
overflow-x: auto;
overflow-y: hidden;
-webkit-flex: 1;
min-width: 0;
position: relative;
}
atom-text-editor.soft-wrap .scroll-view {
overflow-x: hidden;
}
atom-text-editor .underlayer {
z-index: 0;
position: absolute;
min-height: 100%;
}
atom-text-editor .lines {
position: relative;
z-index: 1;
}
atom-text-editor .overlayer {
z-index: 2;
position: absolute;
}
atom-text-editor .line {
white-space: pre;
}
atom-text-editor .line span {
vertical-align: top;
}
atom-text-editor .cursor {
position: absolute;
border-left: 1px solid;
}
atom-text-editor .cursor,
atom-text-editor.is-focused .cursor.blink-off {
visibility: hidden;
}
atom-text-editor.is-focused .cursor {
visibility: visible;
}
.cursor.hidden-cursor {
display: none;
}
atom-text-editor .hidden-input {
padding: 0;
border: 0;
position: absolute;
z-index: -1;
top: 0;
left: 0;
opacity: 0;
width: 1px;
}
atom-text-editor .highlight {
background: none;
padding: 0;
}
atom-text-editor .highlight .region,
atom-text-editor .selection .region {
position: absolute;
pointer-events: none;
z-index: -1;
}
atom-text-editor.mini:not(.react) {
height: auto;
line-height: 25px;
.cursor {
width: 2px;
line-height: 20px;
margin-top: 2px;
}
.gutter {
display: none;
}
.scroll-view {
overflow: hidden;
}
}
+9 -2
Ver Arquivo
@@ -2,11 +2,18 @@ window.onload = function() {
try {
var startTime = Date.now();
var path = require('path');
// Skip "?loadSettings=".
var loadSettings = JSON.parse(decodeURIComponent(location.search.substr(14)));
// Normalize to make sure drive letter case is consistent on Windows
process.resourcesPath = path.normalize(process.resourcesPath);
var devMode = loadSettings.devMode || !loadSettings.resourcePath.startsWith(process.resourcesPath + path.sep);
// Require before the module cache in dev mode
if (loadSettings.devMode) {
if (devMode) {
require('coffee-script').register();
}
@@ -25,7 +32,7 @@ window.onload = function() {
require('vm-compatibility-layer');
if (!loadSettings.devMode) {
if (!devMode) {
require('coffee-script').register();
}
-57
Ver Arquivo
@@ -1,57 +0,0 @@
@import "ui-variables";
.overlay {
position: absolute;
left: 50%;
width: 500px;
margin-left: -250px;
z-index: 9999;
box-sizing: border-box;
background-color: #fff;
padding: 10px;
h1 {
margin-top: 0;
color: @text-color-highlight;
font-size: 1.6em;
font-weight: bold;
}
h2 {
font-size: 1.3em;
}
}
.overlay atom-text-editor.mini {
margin-bottom: 10px;
}
.overlay .message {
padding-top: 5px;
font-size: 11px;
}
.overlay.mini {
width: 200px;
margin-left: -100px;
font-size: 12px;
}
.overlay.from-top {
top: 0;
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.overlay.from-bottom {
bottom: 0;
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.overlay.floating {
left: auto;
}
+98 -11
Ver Arquivo
@@ -1,17 +1,7 @@
@import "ui-variables";
atom-panel-container[location="left"],
atom-panel-container[location="right"] {
display: -webkit-flex;
-webkit-flex-direction: row;
-webkit-align-items: stretch;
height: 100%;
atom-panel {
height: 100%;
}
}
// Override bootstrap styles here.
.panel {
border-radius: 0;
border: none;
@@ -25,6 +15,8 @@ atom-panel-container[location="right"] {
}
}
// interstitial panels
.inset-panel {
.panel-heading {
border-radius: @component-border-radius @component-border-radius 0 0;
@@ -33,6 +25,7 @@ atom-panel-container[location="right"] {
.panel-heading {
margin: 0;
padding: @component-padding;
border-radius: 0;
@@ -48,3 +41,97 @@ atom-panel-container[location="right"] {
top: -5px;
}
}
// Tool panels
atom-panel-container[location="left"],
atom-panel-container[location="right"] {
display: -webkit-flex;
-webkit-flex-direction: row;
-webkit-align-items: stretch;
height: 100%;
atom-panel {
height: 100%;
}
}
atom-panel {
display: block;
}
atom-panel[location="top"],
atom-panel[location="bottom"],
atom-panel[location="left"],
atom-panel[location="right"] {
background-color: @tool-panel-background-color;
}
// deprecated
.tool-panel {
position: relative;
background-color: @tool-panel-background-color;
}
// Modal panels
.overlay, // deprecated .overlay
atom-panel[location="modal"] {
position: absolute;
left: 50%;
width: 500px;
margin-left: -250px;
z-index: 9999;
box-sizing: border-box;
color: @text-color;
background-color: @overlay-background-color;
padding: 10px;
h1 {
margin-top: 0;
color: @text-color-highlight;
font-size: 1.6em;
font-weight: bold;
}
h2 {
font-size: 1.3em;
}
atom-text-editor.mini {
margin-bottom: 10px;
}
.message {
padding-top: 5px;
font-size: 11px;
}
&.mini {
width: 200px;
margin-left: -100px;
font-size: 12px;
}
}
// deprecated: from-top, from-bottom
.overlay.from-top,
atom-panel[location="modal"] {
top: 0;
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
// TODO: Remove these!
.overlay.from-bottom {
bottom: 0;
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.overlay.floating {
left: auto;
}
+19
Ver Arquivo
@@ -0,0 +1,19 @@
@import "ui-variables";
atom-text-editor {
display: block;
font-family: Inconsolata, Monaco, Consolas, 'Courier New', Courier;
line-height: 1.3;
}
atom-text-editor.mini {
font-size: @input-font-size;
line-height: @component-line-height;
max-height: @component-line-height + 2; // +2 for borders
}
// TODO: remove this when the shadow DOM is the default
atom-text-editor .highlight {
background: none;
padding: 0;
}
+252
Ver Arquivo
@@ -0,0 +1,252 @@
@import "ui-variables";
@import "octicon-utf-codes";
@import "octicon-mixins";
.editor-contents {
width: 100%;
}
.editor.shadow, .editor.shadow .editor-contents {
height: 100%;
width: 100%;
}
.underlayer {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -2;
}
.lines {
min-width: 100%;
}
.cursor {
z-index: 4;
pointer-events: none;
box-sizing: border-box;
position: absolute;
border-left: 1px solid;
opacity: 0;
}
.is-focused .cursor {
opacity: 1;
}
.cursors.blink-off .cursor {
opacity: 0;
}
.horizontal-scrollbar {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 15px;
overflow-x: auto;
overflow-y: hidden;
z-index: 3;
cursor: default;
.scrollbar-content {
height: 15px;
}
}
.vertical-scrollbar {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 15px;
overflow-x: hidden;
overflow-y: auto;
z-index: 3;
cursor: default;
}
.scrollbar-corner {
position: absolute;
overflow: auto;
bottom: 0;
right: 0;
}
.scroll-view {
overflow: hidden;
z-index: 0;
-webkit-flex: 1;
min-width: 0;
position: relative;
}
.gutter {
.line-number {
white-space: nowrap;
padding-left: .5em;
.icon-right {
padding: 0 .4em;
&:before {
text-align: center;
}
}
}
}
.placeholder-text {
position: absolute;
color: @text-color-subtle;
}
.editor {
z-index: 0;
}
.editor, .editor-contents {
overflow: hidden;
cursor: text;
display: -webkit-flex;
-webkit-user-select: none;
position: relative;
}
.gutter .line-number.cursor-line {
opacity: 1;
}
.gutter {
overflow: hidden;
text-align: right;
cursor: default;
min-width: 1em;
box-sizing: border-box;
}
.gutter .line-number {
padding-left: .5em;
opacity: 0.6;
}
.gutter .line-numbers {
position: relative;
}
.gutter .line-number.folded.cursor-line {
opacity: 1;
}
.gutter .line-number .icon-right {
.octicon(chevron-down, 0.8em);
display: inline-block;
visibility: hidden;
padding-left: .1em;
padding-right: .5em;
opacity: .6;
}
.gutter:hover .line-number.foldable .icon-right {
visibility: visible;
&:before {
content: @chevron-down;
}
&:hover {
opacity: 1;
}
}
.gutter, .gutter:hover {
.line-number.folded .icon-right {
.octicon(chevron-right, 0.8em);
visibility: visible;
&:before { // chevron-right renders too far right compared to chevron-down
position: relative;
left: -.1em;
content: @chevron-right;
}
}
}
.fold-marker {
cursor: default;
}
.fold-marker:after {
.icon(0.8em, inline);
content: @ellipsis;
padding-left: 0.2em;
}
.line.cursor-line .fold-marker:after {
opacity: 1;
}
.editor.is-blurred .line.cursor-line {
background: rgba(0, 0, 0, 0);
}
.invisible-character {
font-weight: normal !important;
font-style: normal !important;
}
.indent-guide {
display: inline-block;
box-shadow: inset 1px 0;
}
.editor.soft-wrap .scroll-view {
overflow-x: hidden;
}
.underlayer {
z-index: 0;
position: absolute;
min-height: 100%;
}
.lines {
position: relative;
z-index: 1;
}
.overlayer {
z-index: 2;
position: absolute;
width: 100%;
}
.line {
white-space: pre;
}
.line span {
vertical-align: top;
}
.hidden-input {
padding: 0;
border: 0;
position: absolute;
z-index: -1;
top: 0;
left: 0;
opacity: 0;
width: 1px;
}
.highlight .region,
.selection .region {
position: absolute;
pointer-events: none;
z-index: -1;
}
+1 -1
Ver Arquivo
@@ -141,7 +141,7 @@ jasmine.JQuery.matchersClass = {};
if (this.actual instanceof HTMLElement) {
this.actual = jQuery(this.actual);
}
if (this.actual instanceof jQuery) {
if (this.actual && this.actual.jquery) {
var result = jQueryMatchers[methodName].apply(this, arguments);
this.actual = jasmine.JQuery.elementToString(this.actual);
return result;