Comparar commits

...

149 Commits

Autor SHA1 Mensagem Data
Nathan Sobo eabad3dcef Use opacity to blink cursor instead of visibility so blink can be styled 2014-08-14 13:20:43 -06:00
Kevin Sawicki 6ad099260e Upgrade to incompatible-packages@0.8 2014-08-14 12:13:30 -07:00
Kevin Sawicki ebfd921807 Update to deprecation-cop@0.9 2014-08-14 12:11:13 -07:00
Kevin Sawicki 83c77b6e4b Upgrade to autosave@0.15 2014-08-14 11:39:16 -07:00
Kevin Sawicki 654a4392a4 📝 Use script/build in --build-dir example 2014-08-14 09:53:10 -07:00
Kevin Sawicki 8457c74f2f 📝 💄 2014-08-14 09:52:20 -07:00
Kevin Sawicki 88366cb5d4 📝 Mention --build-dir and --install-dir
Closes #3220
2014-08-14 09:51:25 -07:00
Kevin Sawicki c70c819aa2 Upgrade to apm 0.91 2014-08-14 09:47:31 -07:00
Kevin Sawicki 4ac8aba31f Merge pull request #3264 from atom/ks-move-checkout-head-to-git-class
Move checkout head to Git class
2014-08-13 19:12:23 -07:00
Kevin Sawicki 776e431cc5 confirmCheckoutHead -> confirmCheckoutHeadRevision 2014-08-13 19:02:09 -07:00
Kevin Sawicki 5a966240b9 Make message map to command name 2014-08-13 18:51:20 -07:00
Kevin Sawicki 27f0c525ac Add since the last Git commit to detailed message 2014-08-13 18:51:19 -07:00
Kevin Sawicki 00170804e5 Remove spec now covered in git spec 2014-08-13 18:51:19 -07:00
Kevin Sawicki d7e5f05f83 💄 2014-08-13 18:51:19 -07:00
Kevin Sawicki 3ce641f53b Move checkout head editor specs to git spec 2014-08-13 18:51:19 -07:00
Kevin Sawicki 27ca957629 revert -> checkoutHead 2014-08-13 18:51:19 -07:00
Kevin Sawicki 84d0abc52c Use same dialog language as GitHub for Mac 2014-08-13 18:51:19 -07:00
Kevin Sawicki 41c62e8628 Add Git::checkoutHeadForEditor
This moves the logic from Editor::checkoutHead
2014-08-13 18:51:19 -07:00
Kevin Sawicki 1515690302 💄 2014-08-13 17:53:54 -07:00
Kevin Sawicki 2be658b894 Use async BrowserWindow::setRepresentedFilename 2014-08-13 17:47:49 -07:00
Kevin Sawicki d3e1c004fb Add status segment to event name 2014-08-13 17:46:23 -07:00
Kevin Sawicki 62924dfcd1 Use async BrowserWindow::setDocumentEdited 2014-08-13 17:44:15 -07:00
Kevin Sawicki 770e97efff Merge pull request #3171 from dmnd/proxy-icon
Add OS X proxy icon to title bar
2014-08-13 17:41:57 -07:00
Kevin Sawicki 2704d2f15a Upgrade to apm 0.90 2014-08-13 17:32:44 -07:00
Kevin Sawicki 957e45944a Upgrade to spell-check@0.41 2014-08-13 17:32:44 -07:00
Nathan Sobo 16fd14d295 Merge pull request #3206 from atom/ns-invisibles-in-tokens
Handle invisibles at the token level to fix char width measurement
2014-08-13 16:59:11 -06:00
Nathan Sobo 20daed176b Don't show invisibles in mini editors
This moves observation of the config keys to Editor, which assigns the
invisibles hash or null on the TokenizedBuffer via the DisplayBuffer to
control whether we render invisibles or not.
2014-08-13 16:32:14 -06:00
Nathan Sobo 8c11c4a4c6 Deprecate EditorComponent::setInvisibles with grim 2014-08-13 16:32:13 -06:00
Nathan Sobo 7cb44b69ef Don't assign defaults to array config values 2014-08-13 16:32:13 -06:00
Nathan Sobo d37cfb9042 Assign default invisible character glyphs via config defaults
This commit also extends config.get to merge default values into the
returned object if both the assigned and default values are objects.
This allows 'atom.invisibles' to be treated as an object that always has
the default values filled in.
2014-08-13 16:32:13 -06:00
Nathan Sobo 986753981d Use config defaults to assign default invisible characters 2014-08-13 16:32:13 -06:00
Nathan Sobo 970bde9361 Run animation frame after toggling invisibles in EditorComponent spec 2014-08-13 16:31:40 -06:00
Nathan Sobo 7b55946abf Make Editor::moveCursorToFirstCharacterOfLine work with invisible chars 2014-08-13 16:31:40 -06:00
Nathan Sobo c74f6bb615 Remove handling of invisibles from EditorComponent 2014-08-13 16:31:40 -06:00
Nathan Sobo 63f2ab3088 Render end-of-line invisibles based on state of TokenizedLine 2014-08-13 16:31:39 -06:00
Nathan Sobo 742ec6df0d Determine the endOfLineInvisibles for each TokenizedLine 2014-08-13 16:31:39 -06:00
Nathan Sobo 864f9bc2b4 Preserve hasLeading/TrailingWhitespace when copying lines w/ invisibles
This fixes the styling of the leading whitespace of folded lines
2014-08-13 16:31:39 -06:00
Nathan Sobo 73896d100e Add specs for firstNonWhitespaceIndex and firstTrailingWhitespaceIndex 2014-08-13 16:31:39 -06:00
Nathan Sobo 193001d793 Assign invisibles via config in editor-view-spec 2014-08-13 16:31:39 -06:00
Nathan Sobo 052f9580f2 Render correct classes on leading/trailing whitespace spans 2014-08-13 16:31:39 -06:00
Nathan Sobo 2daf70f0e5 Handle invisibles at the token level to fix char width measurement
Fixes #3188
2014-08-13 16:31:39 -06:00
Kevin Sawicki fca9ed07e6 Merge pull request #3169 from lee-dohm/ld-checkout-head
Add confirmation dialog to checkoutHead
2014-08-13 15:24:06 -07:00
Ben Ogle c6fc0d050d Upgrade text-buffer and atom-keymap for grim upgrade 2014-08-13 14:40:53 -07:00
Kevin Sawicki 6e913c47ef Upgrade to language-sass@0.16 2014-08-13 14:39:17 -07:00
Ben Ogle a245624211 Upgrade deprecation-cop to add status item 2014-08-13 13:57:03 -07:00
Ben Ogle 8af8caca55 Upgrade to grim 0.12.0 2014-08-13 13:50:19 -07:00
Ben Ogle bbeb4be5b1 Fix the status bar nested inline blocks.
They were 1 - 2px too low due to nesting inline-blocks.
2014-08-13 13:42:46 -07:00
Ben Ogle 449da91216 Add toShow matcher 2014-08-13 13:42:46 -07:00
Kevin Sawicki 521647e8ac Upgrade to incompatible-packages@0.7 2014-08-13 13:42:19 -07:00
Kevin Sawicki d863638c24 Upgrade to archive-view@0.36 2014-08-13 12:43:42 -07:00
Kevin Sawicki 651df12f9b Upgrade to bracket-matcher@0.54 2014-08-13 11:19:55 -07:00
Kevin Sawicki 83706647d1 Prepare 0.122 2014-08-13 10:01:35 -07:00
Cheng Zhao 59fb4a839e Merge pull request #3248 from atom/atom-shell-0.15.6
Uprade to atom-shell@0.15.6
2014-08-13 20:25:03 +08:00
Cheng Zhao 04e23f581a Uprade to atom-shell@0.15.6 2014-08-13 20:13:57 +08:00
Kevin Sawicki 4574a9e35d Upgrade to language-html@0.24 2014-08-12 18:56:08 -07:00
Kevin Sawicki a2eb4d9303 Keep Packages submenu sorted
This ensures packages are in a predictable order regardless of whether
they are bundled or installed to ~/.atom/packages

Closes #3155
2014-08-12 18:16:00 -07:00
Kevin Sawicki c0a845bc56 Don't run ~/.atom/packages specs when in safe mode
Closes #3215
2014-08-12 17:49:33 -07:00
Kevin Sawicki 1ace5a313c Upgrade to dev-live-reload@0.34 2014-08-12 17:18:55 -07:00
Ben Ogle 161eb3c3d2 Upgrade autocomplete and go-to-line to fix preempt 2014-08-12 17:10:37 -07:00
Ben Ogle 6632a1c63d Merge pull request #3244 from atom/bo-stop-propagation
Stop propagation on all commands in the editor
2014-08-12 17:08:22 -07:00
Ben Ogle ce5eff100c Stop propagation on all commands 2014-08-12 16:54:43 -07:00
Kevin Sawicki 1bf9e14f9f Upgrade to language-xml@0.18 2014-08-12 16:44:10 -07:00
Nathan Sobo 94f40f0ed9 Only allow ReactEditorView::beforeRemove to run once 2014-08-12 17:40:53 -06:00
Nathan Sobo 640881a15e Destroy the editor when an EditorComponent is unmounted
Fixes #3222
2014-08-12 17:40:53 -06:00
Kevin Sawicki ee6c4d7b65 Merge pull request #3243 from kaiserfro/remove-unnecessary-getScrollWidth-params
Remove unnecessary params from Editor::getScrollWidth
2014-08-12 16:35:54 -07:00
Jeffrey Oliver a37aeba909 Remove unnecessary params from Editor::getScrollWidth 2014-08-12 16:33:22 -07:00
Kevin Sawicki 2449fda01d Merge pull request #3230 from atom/ks-really-kill-buffered-process-on-windows
Really kill buffered processes on windows
2014-08-12 16:30:30 -07:00
Kevin Sawicki b572594f92 Ignore errors from process object 2014-08-12 16:15:42 -07:00
Kevin Sawicki fbde059748 Ignore errors killing child processes 2014-08-12 16:15:42 -07:00
Kevin Sawicki 6084ef52e7 Ensure pid is positive 2014-08-12 16:15:42 -07:00
Kevin Sawicki a9f4dfc6b7 Split on whitespace when parsing pids 2014-08-12 16:15:42 -07:00
Kevin Sawicki 8032d6dab2 Return undefined from BufferedProcess::kill 2014-08-12 16:15:42 -07:00
Kevin Sawicki 01ec449fce Kill parent process after children on Windows 2014-08-12 16:15:42 -07:00
Kevin Sawicki e79d66497c Remove comment about killing process 2014-08-12 16:15:41 -07:00
Kevin Sawicki a205c6d190 Use wmic to kill child processes 2014-08-12 16:15:41 -07:00
Nathan Sobo 2911b395ee Handle 'focus' events in ReactEditorView and transfer to the component
Fixes #3234
2014-08-12 17:15:19 -06:00
Nathan Sobo 64c25f17df Shim ReactEditorView::mini property 2014-08-12 17:15:19 -06:00
Ben Ogle 9d3082ec95 Upgrade autocomplete to fix #3242 2014-08-12 16:07:05 -07:00
Ben Ogle 034a377c5e Merge pull request #3241 from atom/bo-add-will-insert
Add will-insert-event with cancel() function
2014-08-12 16:03:10 -07:00
Ben Ogle f0fbdc9842 Revert "Sometimes there might not be a selection."
This reverts commit a73e6e5bd0.
2014-08-12 15:54:32 -07:00
Ben Ogle 96804096e9 Fix specs 2014-08-12 15:44:58 -07:00
Ben Ogle e2c41136f3 preventDefault -> cancel() 2014-08-12 15:35:54 -07:00
Ben Ogle 8b20e2e031 Remove duplicate getModel() 2014-08-12 15:32:18 -07:00
Ben Ogle 722d8cb48b Need to return a range when the text is inserted 2014-08-12 15:30:19 -07:00
Ben Ogle a73e6e5bd0 Sometimes there might not be a selection. 2014-08-12 15:30:02 -07:00
Ben Ogle 4cf68ef017 ::getModel() returns the editor 2014-08-12 15:29:47 -07:00
Ben Ogle b037395551 Add will-insert-text and did-insert-text to insertText() 2014-08-12 15:28:26 -07:00
Ben Ogle 7a26a16511 Only focus when the component is mounted 2014-08-12 15:28:13 -07:00
Kevin Sawicki 30fc3d9e66 Merge pull request #3240 from atom/ks-drop-num-pad-support
Remove number pad support
2014-08-12 15:02:15 -07:00
Ben Ogle 7de2ad34aa Remove opaque backgrounds on mini editors
Fixes #3239
2014-08-12 14:53:09 -07:00
Kevin Sawicki 1bba631ab7 Remove num- keybindings 2014-08-12 14:51:53 -07:00
Kevin Sawicki cbf4087a3a Upgrade to atom-keymap 2.0 2014-08-12 14:51:19 -07:00
Kevin Sawicki a3d72f5e6a Upgrade to bracket-matcher@0.53 2014-08-12 14:27:46 -07:00
Kevin Sawicki aeaa2fad06 Upgrade to atom-package-manager@0.89 2014-08-12 13:07:55 -07:00
Kevin Sawicki a219b90eea Upgrade to exception-reporting@0.20 2014-08-12 13:01:03 -07:00
Kevin Sawicki 7086c60e6b Upgrade to git-utils@2.1.4 2014-08-12 12:48:23 -07:00
Kevin Sawicki 0af4c82f36 Upgrade to settings-view@0.139 2014-08-12 12:44:42 -07:00
Kevin Sawicki acf5ab816e Bump grunt-coffeelint for JSON fix 2014-08-12 10:45:39 -07:00
Kevin Sawicki 6aa8c8bab9 Go back to using grunt-coffeelint fork for CI fixes 2014-08-12 10:37:13 -07:00
Kevin Sawicki b5c939dee1 Upgrade to incompatible-packages@0.6 2014-08-12 10:25:18 -07:00
Kevin Sawicki 90d9315d45 Merge pull request #3223 from atom/ks-use-beforeunload
Save state during beforeunload event
2014-08-12 10:22:03 -07:00
Kevin Sawicki 7de2f57088 💄 2014-08-12 09:37:48 -07:00
Kevin Sawicki 1488867063 Remove hiding of body during reload
This appears to no longer be needed on Chrome 36
2014-08-12 08:49:28 -07:00
Kevin Sawicki 59d62d48db Remove views and destroy project during unload 2014-08-12 08:49:28 -07:00
Kevin Sawicki 97c2fc09f0 Only unload editor window when confirmed 2014-08-12 08:49:28 -07:00
Kevin Sawicki 16d2e41309 Use beforeunload instead of unload
unload is asynchronous in Chrome 36 and so saving the state while
reloading may not happen before the state is read on the new render
process.
2014-08-12 08:49:28 -07:00
Lee Dohm 13f66fb2ae Add a step to revert unsaved changes
I took the key part from PR #3183 and added it to the post-confirmation
flow.
2014-08-12 00:37:51 -07:00
Lee Dohm d6a8217e94 Add config option for checkoutHead confirmation
Per the discussion with @kevinsawicki in #3168, I have added a config
option `editor.confirmCheckoutHead` that defaults to `true`. When the
`editor:checkout-head-revision` command is executed, a confirmation
dialog now shows that states which file is to be reverted and asks the
user to "Revert" or "Cancel". If the config option is set to `false`,
the old behavior, simply reverting without prompting, is used.

I also added tests to ensure that the confirmation dialog is displayed
or not in the right configurations.
2014-08-12 00:19:47 -07:00
Lee Dohm 8e649e3008 Add confirmation dialog to checkoutHead
There have been a few reports of files mysteriously going back to the
last version in the tree. My theory is that it is because of people
fat-fingering the Undo command because the default keyboard mapping is
too similar. This will at least prevent most accidental data loss.
2014-08-11 20:58:42 -07:00
Kevin Sawicki 8dffb45fd7 Upgrade to language-c@0.27 2014-08-11 20:34:37 -07:00
Kevin Sawicki c34ce0d2d0 Merge pull request #3218 from dmnd/coffeelint-config-file
Move coffeelint settings to external file
2014-08-11 16:41:42 -07:00
Desmond Brand 61daf1cc36 Use grunt-coffeelint@0.0.13 instead of forked version
Test Plan:

```
$ ./script/grunt coffeelint
Running "coffeelint:src" (coffeelint) task
>> 80 files lint free.

Running "coffeelint:build" (coffeelint) task
>> 23 files lint free.

Running "coffeelint:test" (coffeelint) task
>> 40 files lint free.
Done, without errors.
```
2014-08-11 16:38:24 -07:00
Desmond Brand 1201fb6a5d ignore no_unnecessary_fat_arrows too 2014-08-11 16:32:13 -07:00
Kevin Sawicki 7a5a329393 Upgrade to language-sass@0.15 2014-08-11 15:33:10 -07:00
Kevin Sawicki f447781e01 Allow any bundled theme when in safe mode
Check enabled names against the bundled names and ensure
one bundled UI and one bundled syntax theme are enabled,
defaulting to the dark themes when necessary.
2014-08-11 15:24:49 -07:00
Kevin Sawicki 070d9d0b46 Merge pull request #3186 from maschs/ms-safeModeThemes
Load the default themes in safe mode
2014-08-11 14:51:14 -07:00
Kevin Sawicki 49b4671076 Merge pull request #3208 from XemsDoom/fix-win32-buffprocess
Fixes additional quotes on win32 in BufferedProcess
2014-08-11 14:45:08 -07:00
Luca Moser 28a0e94bb9 Fixes unexecutable commands on win32 in BP
Signed-off-by: Luca Moser <moser.luca@gmail.com>
2014-08-11 20:24:57 +02:00
Kevin Sawicki ab2c5bfc35 Upgrade to bracket-matcher@0.52 2014-08-11 11:21:03 -07:00
Ben Ogle 80c64deb21 Merge pull request #3219 from wernight/patch-1
Update linux.md
2014-08-11 11:06:33 -07:00
Kevin Sawicki 69af432965 Upgrade to base16-tomorrow-dark-theme 2014-08-11 09:41:59 -07:00
Cheng Zhao e788612ef4 Merge pull request #3196 from atom/atom-shell-v0.15.4
Upgrade to atom-shell@0.15.4
2014-08-11 21:24:15 +08:00
Cheng Zhao 62803efde0 Upgrade to atom-shell@0.15.5 2014-08-11 20:54:43 +08:00
Cheng Zhao 01696b4d11 Revert "Make menu bar auto-hide."
This reverts commit 64731bff46.
2014-08-11 20:54:26 +08:00
Werner Beroux 2c2dc61fa0 Update linux.md
Clarify the build steps. The most important is that initialy "Create ..." and "Install ..." could be interpreted as "(User should) create/install ..." while it should mean "(To) create/install ... (do)".
2014-08-11 11:00:47 +02:00
Desmond Brand 66ce001961 Move coffeelint settings to external file
The motivation is for this is to allow `coffeelint` config to be shared by
`script/grunt coffeelint`, global `coffeelint` and inline linting via
`AtomLinter`.

Test Plan:

Made some deliberate lint errors then ran `script/grunt coffeelint` and
verified the output looked the same with and without this change.
2014-08-10 21:41:55 -07:00
Kevin Sawicki 3aa6cc827c Upgrade to markdown-preview@0.99 2014-08-08 11:44:47 -07:00
Maximilian Schüßler c2304e1124 Fix indentation 2014-08-08 19:59:45 +02:00
Kevin Sawicki 07f8f0915c Upgrade to language-sql@0.10 2014-08-08 10:35:58 -07:00
Kevin Sawicki 7725c78c5e Upgrade to language-yaml@0.15 2014-08-08 09:45:28 -07:00
Ivan Žužak 0624720634 Upgrade to markdown-preview@0.97.0 2014-08-08 17:59:57 +02:00
Cheng Zhao 64731bff46 Make menu bar auto-hide. 2014-08-07 21:24:20 +08:00
Cheng Zhao 878c393e8e Upgrade to atom-shell@0.15.4 2014-08-07 20:30:20 +08:00
Nathan Sobo 84064a811c :non_potable_water: Unsubscribe from window resize in EditorComponent
This fixes a major memory leak
2014-08-07 04:59:02 -06:00
Cheng Zhao 3c932d6d91 Upgrade to atom-shell@0.15.3 2014-08-07 00:11:40 +08:00
Ben Ogle a24d1d1af7 Upgrade find-and-replace 2014-08-05 11:31:58 -07:00
Ben Ogle edb5b43d64 Upgrade settings view for #3176 2014-08-05 11:20:38 -07:00
Ben Ogle ac496e1fa4 Upgrade tabs to fix hanging in #1663 2014-08-05 10:54:57 -07:00
Ben Ogle 103f3f8597 Merge pull request #3185 from sryze/patch-1
Add build fix from #2435
2014-08-05 10:17:24 -07:00
Kevin Sawicki 9842baedce Use Atom as FileDescription
This is the text presented when the app is presented in a select list.

Closes #3179
2014-08-05 07:59:02 -07:00
Kevin Sawicki aaa916f78d Upgrade to language-coffee-script@0.29 2014-08-05 07:52:49 -07:00
Maximilian Schüßler b463d9d876 Load the default themes in safe mode 2014-08-05 13:32:16 +02:00
Sergey Zolotarev 7f6a4cccaf Add build fix from #2435 2014-08-05 18:00:25 +07:00
Desmond Brand d5e30e83f6 Don't use project path as fallback icon for item with no path
Stops the project folder icon appearing in places that don't make sense
like settings and new files.

Test Plan:

  * Opened settings and didn't see the project folder icon
  * Closed all tabs and saw the project folder icon
2014-08-04 20:51:37 -07:00
Desmond Brand d16c0e9e41 Implement setDocumentEdited too
As requested by @philipgiuliani

Test Plan:
Opened an existing file and made a modification. The icon fades at the same
time the tab close button changes to a circle. Undo makes the icon opaque
again.
2014-08-04 20:45:24 -07:00
Desmond Brand bd8ac3bb32 path -> proxyIconPath
Test plan:
Crossed fingers
2014-08-04 11:28:29 -07:00
Kevin Sawicki 87edff1e42 Upgrade to language-gfm@0.46 2014-08-04 11:09:42 -07:00
Kevin Sawicki 96f35d3cde Upgrade to language-ruby@0.34 2014-08-04 11:09:41 -07:00
Desmond Brand e1f4b7415a Add OS X proxy icon to title bar
Fixes #1891.

Test Plan:

  * Opened Atom window in directory, verified directory icon shows up
  * Opened a file and verified icon changed
  * Right clicked icon, verified menu appears
  * Drag file to terminal and it pastes the file path (yay)
  * Opened a new Atom window and opened some files in that to make sure that
    it didn't change the original window

I didn't add any specs for this - advice welcome here. I also haven't tested
on Windows or Linux but it looks like `setRepresentedFilename` is a noop on
those platforms.
2014-08-03 17:14:17 -07:00
45 arquivos alterados com 751 adições e 276 exclusões
+1 -1
Ver Arquivo
@@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "0.88.0"
"atom-package-manager": "0.91.0"
}
}
+1 -6
Ver Arquivo
@@ -144,12 +144,7 @@ module.exports = (grunt) ->
coffeelint:
options:
no_empty_param_list:
level: 'error'
max_line_length:
level: 'ignore'
indentation:
level: 'ignore'
configFile: 'coffeelint.json'
src: [
'dot-atom/**/*.coffee'
'exports/**/*.coffee'
+1 -1
Ver Arquivo
@@ -13,7 +13,7 @@
"github-releases": "~0.2.0",
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git",
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe",
"grunt-contrib-coffee": "~0.9.0",
"grunt-contrib-csslint": "~0.1.2",
"grunt-contrib-less": "~0.8.0",
+2 -2
Ver Arquivo
@@ -45,8 +45,8 @@ module.exports = (grunt) ->
strings =
CompanyName: 'GitHub, Inc.'
FileDescription: 'The hackable editor'
LegalCopyright: 'Copyright (C) 2013 GitHub, Inc. All rights reserved'
FileDescription: 'Atom'
LegalCopyright: 'Copyright (C) 2014 GitHub, Inc. All rights reserved'
ProductName: 'Atom'
ProductVersion: version
+14
Ver Arquivo
@@ -0,0 +1,14 @@
{
"indentation": {
"level": "ignore"
},
"max_line_length": {
"level": "ignore"
},
"no_empty_param_list": {
"level": "error"
},
"no_unnecessary_fat_arrows": {
"level": "ignore"
}
}
+31 -13
Ver Arquivo
@@ -15,14 +15,17 @@ Ubuntu LTS 12.04 64-bit is the recommended platform.
* development headers for [GNOME Keyring](https://wiki.gnome.org/Projects/GnomeKeyring)
### Ubuntu / Debian
* `sudo apt-get install build-essential git libgnome-keyring-dev`
* Instructions for [Node.js](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#ubuntu-mint-elementary-os).
### Fedora
* `sudo yum --assumeyes install make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel`
* Instructions for [Node.js](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#fedora).
### Arch
* `sudo pacman -S base-devel git nodejs libgnome-keyring`
* `export PYTHON=/usr/bin/python2` before building Atom.
@@ -30,26 +33,41 @@ Ubuntu LTS 12.04 64-bit is the recommended platform.
If you have problems with permissions don't forget to prefix with `sudo`
Create the atom application at `$TMPDIR/atom-build/Atom`:
From the cloned repository directory:
```sh
script/build
```
1. Build:
Install the `atom` and `apm` commands to `/usr/local/bin`:
```sh
$ script/build
```
This will create the atom application at `$TMPDIR/atom-build/Atom`.
2. Install the `atom` and `apm` commands to `/usr/local/bin` by executing:
```sh
sudo script/grunt install
```
```sh
$ sudo script/grunt install
```
3. *Optionally*, you may generate a `.deb` package at `$TMPDIR/atom-build`:
Generate a `.deb` package at `$TMPDIR/atom-build`: (*optional*)
```sh
script/grunt mkdeb
```
```sh
$ script/grunt mkdeb
```
Use the newly installed atom by restarting any running atom instances.
## Advanced Options
### Custom install directory
```sh
sudo script/grunt install --install-dir /install/atom/here
```
### Custom build directory
```sh
script/build --build-dir /build/atom/here
```
## Troubleshooting
### Exception: "TypeError: Unable to watch path"
+13
Ver Arquivo
@@ -66,6 +66,19 @@ If none of this works, do install Github for Windows and use its Git shell. Make
* https://github.com/TooTallNate/node-gyp/issues/297
* https://code.google.com/p/gyp/issues/detail?id=393
* `script/build` stops at installing runas with 'Failed at the runas@0.5.4 install script.'
See the next item.
* `error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found.`
* If you're building atom with Visual Studio 2013 try executing the following
command in your Git shell and then re-run `script/build`:
```
$env:GYP_MSVS_VERSION=2013
```
* Other `node-gyp` errors on first build attempt, even though the right node and python versions are installed.
* Do try the build command one more time, as experience shows it often works on second try in many of these cases.
-2
Ver Arquivo
@@ -12,7 +12,6 @@
# Sublime Parity
'tab': 'editor:indent'
'enter': 'editor:newline'
'num-enter': 'editor:newline'
'shift-tab': 'editor:outdent-selected-rows'
'ctrl-K': 'editor:delete-line'
@@ -27,7 +26,6 @@
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'
'enter': 'native!'
'num-enter': 'native!'
'backspace': 'native!'
'shift-backspace': 'native!'
'delete': 'native!'
-1
Ver Arquivo
@@ -21,7 +21,6 @@
'cmd-O': 'application:open-dev'
'cmd-alt-ctrl-s': 'application:run-all-specs'
'enter': 'core:confirm'
'num-enter': 'core:confirm'
'escape': 'core:cancel'
'up': 'core:move-up'
'down': 'core:move-down'
-1
Ver Arquivo
@@ -1,7 +1,6 @@
'body':
# Atom Specific
'enter': 'core:confirm'
'num-enter': 'core:confirm'
'escape': 'core:cancel'
'up': 'core:move-up'
'down': 'core:move-down'
-1
Ver Arquivo
@@ -5,7 +5,6 @@
# Atom Specific
'enter': 'core:confirm'
'num-enter': 'core:confirm'
'escape': 'core:cancel'
'up': 'core:move-up'
'down': 'core:move-down'
+30 -30
Ver Arquivo
@@ -1,7 +1,7 @@
{
"name": "atom",
"productName": "Atom",
"version": "0.121.0",
"version": "0.122.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.15.2",
"atomShellVersion": "0.15.6",
"dependencies": {
"async": "0.2.6",
"atom-keymap": "^1.0.2",
"atom-keymap": "^2.0.1",
"bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372",
"clear-cut": "0.4.0",
"coffee-script": "1.7.0",
@@ -31,8 +31,8 @@
"fs-plus": "^2.2.6",
"fstream": "0.1.24",
"fuzzaldrin": "^1.1",
"git-utils": "^2.1.3",
"grim": "0.11.0",
"git-utils": "^2.1.4",
"grim": "0.12.0",
"guid": "0.0.10",
"jasmine-tagged": "^1.1.2",
"less-cache": "0.13.0",
@@ -56,7 +56,7 @@
"serializable": "^1",
"space-pen": "3.2.0",
"temp": "0.7.0",
"text-buffer": "^3.0.0",
"text-buffer": "^3.0.1",
"theorist": "^1",
"underscore-plus": "^1.5.1",
"vm-compatibility-layer": "0.1.0"
@@ -66,43 +66,43 @@
"atom-dark-ui": "0.33.0",
"atom-light-syntax": "0.20.0",
"atom-light-ui": "0.29.0",
"base16-tomorrow-dark-theme": "0.20.0",
"base16-tomorrow-dark-theme": "0.21.0",
"base16-tomorrow-light-theme": "0.4.0",
"solarized-dark-syntax": "0.22.0",
"solarized-light-syntax": "0.12.0",
"archive-view": "0.35.0",
"autocomplete": "0.29.0",
"archive-view": "0.36.0",
"autocomplete": "0.31.0",
"autoflow": "0.17.0",
"autosave": "0.14.0",
"autosave": "0.15.0",
"background-tips": "0.15.0",
"bookmarks": "0.27.0",
"bracket-matcher": "0.51.0",
"bracket-matcher": "0.54.0",
"command-palette": "0.24.0",
"deprecation-cop": "0.7.0",
"dev-live-reload": "0.33.0",
"exception-reporting": "0.19.0",
"deprecation-cop": "0.9.0",
"dev-live-reload": "0.34.0",
"exception-reporting": "0.20.0",
"feedback": "0.33.0",
"find-and-replace": "0.127.0",
"find-and-replace": "0.128.0",
"fuzzy-finder": "0.57.0",
"git-diff": "0.37.0",
"go-to-line": "0.23.0",
"go-to-line": "0.24.0",
"grammar-selector": "0.27.0",
"image-view": "0.36.0",
"incompatible-packages": "0.5.0",
"incompatible-packages": "0.8.0",
"keybinding-resolver": "0.19.0",
"link": "0.25.0",
"markdown-preview": "0.95.0",
"markdown-preview": "0.99.0",
"metrics": "0.33.0",
"open-on-github": "0.29.0",
"package-generator": "0.31.0",
"release-notes": "0.36.0",
"settings-view": "0.137.0",
"settings-view": "0.139.0",
"snippets": "0.51.0",
"spell-check": "0.40.0",
"spell-check": "0.41.0",
"status-bar": "0.42.0",
"styleguide": "0.29.0",
"symbols-view": "0.63.0",
"tabs": "0.48.0",
"tabs": "0.49.0",
"timecop": "0.22.0",
"tree-view": "0.112.0",
"update-package-dependencies": "0.6.0",
@@ -110,13 +110,13 @@
"whitespace": "0.25.0",
"wrap-guide": "0.21.0",
"language-c": "0.26.0",
"language-coffee-script": "0.28.0",
"language-c": "0.27.0",
"language-coffee-script": "0.29.0",
"language-css": "0.17.0",
"language-gfm": "0.45.0",
"language-gfm": "0.46.0",
"language-git": "0.9.0",
"language-go": "0.16.0",
"language-html": "0.22.0",
"language-html": "0.24.0",
"language-hyperlink": "0.10.0",
"language-java": "0.11.0",
"language-javascript": "0.39.0",
@@ -128,17 +128,17 @@
"language-php": "0.15.0",
"language-property-list": "0.7.0",
"language-python": "0.18.0",
"language-ruby": "0.33.0",
"language-ruby": "0.34.0",
"language-ruby-on-rails": "0.15.0",
"language-sass": "0.14.0",
"language-sass": "0.16.0",
"language-shellscript": "0.8.0",
"language-source": "0.8.0",
"language-sql": "0.9.0",
"language-sql": "0.10.0",
"language-text": "0.6.0",
"language-todo": "0.10.0",
"language-toml": "0.12.0",
"language-xml": "0.17.0",
"language-yaml": "0.14.0"
"language-xml": "0.18.0",
"language-yaml": "0.15.0"
},
"private": true,
"scripts": {
+12
Ver Arquivo
@@ -23,6 +23,18 @@ describe "Config", ->
retrievedValue.array[1].b = 2.1
expect(atom.config.get('value')).toEqual(array: [1, b: 2, 3])
it "merges defaults into the returned value if both the assigned value and the default value are objects", ->
atom.config.setDefaults("foo", a: 1, b: 2)
atom.config.set("foo", a: 3)
expect(atom.config.get("foo")).toEqual {a: 3, b: 2}
atom.config.set("foo", 7)
expect(atom.config.get("foo")).toBe 7
atom.config.set("bar.baz", a: 3)
atom.config.setDefaults("bar", baz: 7)
expect(atom.config.get("bar.baz")).toEqual {a: 3}
describe ".set(keyPath, value)", ->
it "allows a key path's value to be written", ->
expect(atom.config.set("foo.bar.baz", 42)).toBe 42
+24 -11
Ver Arquivo
@@ -209,25 +209,32 @@ describe "EditorComponent", ->
atom.config.set("editor.showInvisibles", true)
atom.config.set("editor.invisibles", invisibles)
nextAnimationFrame()
it "re-renders the lines when the showInvisibles config option changes", ->
editor.setText " a line with tabs\tand spaces "
editor.setText " a line with tabs\tand spaces \n"
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).textContent).toBe "#{invisibles.space}a line with tabs#{invisibles.tab}and spaces#{invisibles.space}#{invisibles.eol}"
atom.config.set("editor.showInvisibles", false)
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).textContent).toBe " a line with tabs and spaces "
atom.config.set("editor.showInvisibles", true)
expect(component.lineNodeForScreenRow(0).textContent).toBe "#{invisibles.space}a line with tabs#{invisibles.tab}and spaces#{invisibles.space}#{invisibles.eol}"
it "displays spaces, tabs, and newlines as visible characters", ->
editor.setText " a line with tabs\tand spaces "
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).textContent).toBe "#{invisibles.space}a line with tabs#{invisibles.tab}and spaces#{invisibles.space}#{invisibles.eol}"
it "displays leading/trailing spaces, tabs, and newlines as visible characters", ->
editor.setText " a line with tabs\tand spaces \n"
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).textContent).toBe "#{invisibles.space}a line with tabs#{invisibles.tab}and spaces#{invisibles.space}#{invisibles.eol}"
leafNodes = getLeafNodes(component.lineNodeForScreenRow(0))
expect(leafNodes[0].classList.contains('invisible-character')).toBe true
expect(leafNodes[leafNodes.length - 1].classList.contains('invisible-character')).toBe true
it "displays newlines as their own token outside of the other tokens' scopes", ->
editor.setText "var"
editor.setText "var\n"
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).innerHTML).toBe "<span class=\"source js\"><span class=\"storage modifier js\">var</span></span><span class=\"invisible-character\">#{invisibles.eol}</span>"
@@ -241,10 +248,12 @@ describe "EditorComponent", ->
it "renders an nbsp on empty lines when the line-ending character is an empty string", ->
atom.config.set("editor.invisibles", eol: '')
nextAnimationFrame()
expect(component.lineNodeForScreenRow(10).textContent).toBe nbsp
it "renders an nbsp on empty lines when no line-ending character is defined", ->
atom.config.set("editor.invisibles", eol: null)
it "renders an nbsp on empty lines when the line-ending character is false", ->
atom.config.set("editor.invisibles", eol: false)
nextAnimationFrame()
expect(component.lineNodeForScreenRow(10).textContent).toBe nbsp
it "interleaves invisible line-ending characters with indent guides on empty lines", ->
@@ -268,7 +277,7 @@ describe "EditorComponent", ->
describe "when soft wrapping is enabled", ->
beforeEach ->
editor.setText "a line that wraps "
editor.setText "a line that wraps \n"
editor.setSoftWrap(true)
nextAnimationFrame()
componentNode.style.width = 16 * charWidth + editor.getVerticalScrollbarWidth() + 'px'
@@ -2103,9 +2112,13 @@ describe "EditorComponent", ->
it "adds the 'mini' class to the wrapper view", ->
expect(wrapperNode.classList.contains('mini')).toBe true
it "does not have an opaque background on lines", ->
expect(component.refs.lines.getDOMNode().getAttribute('style')).not.toContain 'background-color'
it "does not render invisible characters", ->
component.setInvisibles(eol: 'E')
component.setShowInvisibles(true)
atom.config.set('editor.invisibles', eol: 'E')
atom.config.set('editor.showInvisibles', true)
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).textContent).toBe 'var quicksort = function () {'
it "does not assign an explicit line-height on the editor contents", ->
+60
Ver Arquivo
@@ -499,6 +499,15 @@ describe "Editor", ->
cursor = editor.getCursor()
expect(cursor.getBufferPosition()).toEqual [1,0]
describe "when invisible characters are enabled", ->
it "moves to the first character of the current line without being confused by the invisible characters", ->
atom.config.set('editor.showInvisibles', true)
editor.setCursorScreenPosition [1,7]
editor.moveCursorToFirstCharacterOfLine()
expect(editor.getCursorBufferPosition()).toEqual [1,2]
editor.moveCursorToFirstCharacterOfLine()
expect(editor.getCursorBufferPosition()).toEqual [1,0]
describe ".moveCursorToBeginningOfWord()", ->
it "moves the cursor to the beginning of the word", ->
editor.setCursorBufferPosition [0, 8]
@@ -1470,6 +1479,15 @@ describe "Editor", ->
describe "buffer manipulation", ->
describe ".insertText(text)", ->
describe "when there is a single selection", ->
beforeEach ->
editor.setSelectedBufferRange([[1, 0], [1, 2]])
it "will-insert-text and did-insert-text events are emitted when inserting text", ->
range = editor.insertText('xxx')
expect(range).toEqual [ [[1, 0], [1, 3]] ]
expect(buffer.lineForRow(1)).toBe 'xxxvar sort = function(items) {'
describe "when there are multiple empty selections", ->
describe "when the cursors are on the same line", ->
it "inserts the given text at the location of each cursor and moves the cursors to the end of each cursor's inserted text", ->
@@ -1547,6 +1565,48 @@ describe "Editor", ->
editor.insertText('holy cow')
expect(editor.lineForScreenRow(2).fold).toBeUndefined()
describe "when will-insert-text and did-insert-text events are used", ->
beforeEach ->
editor.setSelectedBufferRange([[1, 0], [1, 2]])
it "will-insert-text and did-insert-text events are emitted when inserting text", ->
willInsertSpy = jasmine.createSpy().andCallFake ->
expect(buffer.lineForRow(1)).toBe ' var sort = function(items) {'
didInsertSpy = jasmine.createSpy().andCallFake ->
expect(buffer.lineForRow(1)).toBe 'xxxvar sort = function(items) {'
editor.on('will-insert-text', willInsertSpy)
editor.on('did-insert-text', didInsertSpy)
expect(editor.insertText('xxx')).toBeTruthy()
expect(buffer.lineForRow(1)).toBe 'xxxvar sort = function(items) {'
expect(willInsertSpy).toHaveBeenCalled()
expect(didInsertSpy).toHaveBeenCalled()
options = willInsertSpy.mostRecentCall.args[0]
expect(options.text).toBe 'xxx'
expect(options.cancel).toBeDefined()
options = didInsertSpy.mostRecentCall.args[0]
expect(options.text).toBe 'xxx'
it "text insertion is prevented when cancel is called from a will-insert-text handler", ->
willInsertSpy = jasmine.createSpy().andCallFake ({cancel}) ->
cancel()
didInsertSpy = jasmine.createSpy()
editor.on('will-insert-text', willInsertSpy)
editor.on('did-insert-text', didInsertSpy)
expect(editor.insertText('xxx')).toBe false
expect(buffer.lineForRow(1)).toBe ' var sort = function(items) {'
expect(willInsertSpy).toHaveBeenCalled()
expect(didInsertSpy).not.toHaveBeenCalled()
describe ".insertNewline()", ->
describe "when there is a single cursor", ->
describe "when the cursor is at the beginning of a line", ->
+2 -33
Ver Arquivo
@@ -2414,37 +2414,6 @@ describe "EditorView", ->
expect(editor.getCursor().getScreenPosition().row).toBe(0)
expect(editorView.getFirstVisibleScreenRow()).toBe(0)
describe ".checkoutHead()", ->
[filePath] = []
beforeEach ->
workingDirPath = temp.mkdirSync('atom-working-dir')
fs.copySync(path.join(__dirname, 'fixtures', 'git', 'working-dir'), workingDirPath)
fs.renameSync(path.join(workingDirPath, 'git.git'), path.join(workingDirPath, '.git'))
atom.project.setPath(workingDirPath)
filePath = atom.project.resolve('file.txt')
waitsForPromise ->
atom.workspace.open(filePath).then (o) -> editor = o
runs ->
editorView.edit(editor)
it "restores the contents of the editor view to the HEAD revision", ->
editor.setText('')
editor.save()
fileChangeHandler = jasmine.createSpy('fileChange')
editor.getBuffer().file.on 'contents-changed', fileChangeHandler
editorView.checkoutHead()
waitsFor "file to trigger contents-changed event", ->
fileChangeHandler.callCount > 0
runs ->
expect(editor.getText()).toBe('undefined')
describe ".pixelPositionForBufferPosition(position)", ->
describe "when the editor view is detached", ->
it "returns top and left values of 0", ->
@@ -2998,8 +2967,8 @@ describe "EditorView", ->
expect(editorView.lineElementForScreenRow(rowNumber).text()).toBe buffer.lineForRow(rowNumber)
it "correctly calculates the position left for non-monospaced invisibles", ->
editorView.setShowInvisibles(true)
editorView.setInvisibles tab: ''
atom.config.set('editor.showInvisibles', true)
atom.config.set('editor.invisibles', tab: '')
editor.setText('\tx')
editorView.setFontFamily('serif')
+32
Ver Arquivo
@@ -119,6 +119,38 @@ describe "Git", ->
repo.checkoutHead(filePath)
expect(statusHandler.callCount).toBe 1
describe ".checkoutHeadForEditor(editor)", ->
[filePath, editor] = []
beforeEach ->
workingDirPath = copyRepository()
repo = new Git(workingDirPath)
filePath = path.join(workingDirPath, 'a.txt')
fs.writeFileSync(filePath, 'ch ch changes')
waitsForPromise ->
atom.workspace.open(filePath)
runs ->
editor = atom.workspace.getActiveEditor()
it "displays a confirmation dialog by default", ->
spyOn(atom, 'confirm').andCallFake ({buttons}) -> buttons.OK()
atom.config.set('editor.confirmCheckoutHeadRevision', true)
repo.checkoutHeadForEditor(editor)
expect(fs.readFileSync(filePath, 'utf8')).toBe ''
it "does not display a dialog when confirmation is disabled", ->
spyOn(atom, 'confirm')
atom.config.set('editor.confirmCheckoutHeadRevision', false)
repo.checkoutHeadForEditor(editor)
expect(fs.readFileSync(filePath, 'utf8')).toBe ''
expect(atom.confirm).not.toHaveBeenCalled()
describe ".destroy()", ->
it "throws an exception when any method is called after it is called", ->
repo = new Git(require.resolve('./fixtures/git/master.git/HEAD'))
+8 -1
Ver Arquivo
@@ -28,7 +28,7 @@ atom.keymaps.loadBundledKeymaps()
keyBindingsToRestore = atom.keymaps.getKeyBindings()
$(window).on 'core:close', -> window.close()
$(window).on 'unload', ->
$(window).on 'beforeunload', ->
atom.storeWindowDimensions()
atom.saveSync()
$('html,body').css('overflow', 'auto')
@@ -211,6 +211,13 @@ addCustomMatchers = (spec) ->
element = element.get(0) if element.jquery
element.webkitMatchesSelector(":focus") or element.querySelector(":focus")
toShow: ->
notText = if @isNot then " not" else ""
element = @actual
element = element.get(0) if element.jquery
@message = -> return "Expected element '#{element}' or its descendants #{notText} to show."
element.style.display in ['block', 'inline-block', 'static', 'fixed']
window.keyIdentifierForKey = (key) ->
if key.length > 1 # named key
key
+56
Ver Arquivo
@@ -310,3 +310,59 @@ describe "ThemeManager", ->
runs ->
expect(console.warn.callCount).toBe 1
expect(console.warn.argsForCall[0][0].length).toBeGreaterThan 0
describe "when in safe mode", ->
beforeEach ->
themeManager = new ThemeManager({packageManager: atom.packages, resourcePath, configDirPath, safeMode: true})
describe 'when the enabled UI and syntax themes are bundled with Atom', ->
beforeEach ->
atom.config.set('core.themes', ['atom-light-ui', 'atom-dark-syntax'])
waitsForPromise ->
themeManager.activateThemes()
it 'uses the enabled themes', ->
activeThemeNames = themeManager.getActiveNames()
expect(activeThemeNames.length).toBe(2)
expect(activeThemeNames).toContain('atom-light-ui')
expect(activeThemeNames).toContain('atom-dark-syntax')
describe 'when the enabled UI and syntax themes are not bundled with Atom', ->
beforeEach ->
atom.config.set('core.themes', ['installed-dark-ui', 'installed-dark-syntax'])
waitsForPromise ->
themeManager.activateThemes()
it 'uses the default dark UI and syntax themes', ->
activeThemeNames = themeManager.getActiveNames()
expect(activeThemeNames.length).toBe(2)
expect(activeThemeNames).toContain('atom-dark-ui')
expect(activeThemeNames).toContain('atom-dark-syntax')
describe 'when the enabled UI theme is not bundled with Atom', ->
beforeEach ->
atom.config.set('core.themes', ['installed-dark-ui', 'atom-light-syntax'])
waitsForPromise ->
themeManager.activateThemes()
it 'uses the default dark UI theme', ->
activeThemeNames = themeManager.getActiveNames()
expect(activeThemeNames.length).toBe(2)
expect(activeThemeNames).toContain('atom-dark-ui')
expect(activeThemeNames).toContain('atom-light-syntax')
describe 'when the enabled syntax theme is not bundled with Atom', ->
beforeEach ->
atom.config.set('core.themes', ['atom-light-ui', 'installed-dark-syntax'])
waitsForPromise ->
themeManager.activateThemes()
it 'uses the default dark syntax theme', ->
activeThemeNames = themeManager.getActiveNames()
expect(activeThemeNames.length).toBe(2)
expect(activeThemeNames).toContain('atom-light-ui')
expect(activeThemeNames).toContain('atom-dark-syntax')
+71 -2
Ver Arquivo
@@ -1,4 +1,5 @@
TokenizedBuffer = require '../src/tokenized-buffer'
TextBuffer = require 'text-buffer'
_ = require 'underscore-plus'
describe "TokenizedBuffer", ->
@@ -12,6 +13,9 @@ describe "TokenizedBuffer", ->
waitsForPromise ->
atom.packages.activatePackage('language-javascript')
afterEach ->
tokenizedBuffer?.destroy()
startTokenizing = (tokenizedBuffer) ->
tokenizedBuffer.setVisible(true)
@@ -584,42 +588,95 @@ describe "TokenizedBuffer", ->
atom.config.set('editor.tabLength', 0)
expect(tokenizedBuffer.tokenForPosition([0,0]).value).toBe ' '
describe "when the invisibles value changes", ->
beforeEach ->
it "updates the tokens with the appropriate invisible characters", ->
buffer = new TextBuffer(text: " \t a line with tabs\tand \tspaces \t ")
tokenizedBuffer = new TokenizedBuffer({buffer})
fullyTokenize(tokenizedBuffer)
tokenizedBuffer.setInvisibles(space: 'S', tab: 'T')
fullyTokenize(tokenizedBuffer)
expect(tokenizedBuffer.lineForScreenRow(0).text).toBe "SST Sa line with tabsTand T spacesSTS"
# Also needs to work for copies
expect(tokenizedBuffer.lineForScreenRow(0).copy().text).toBe "SST Sa line with tabsTand T spacesSTS"
it "assigns endOfLineInvisibles to tokenized lines", ->
buffer = new TextBuffer(text: "a line that ends in a carriage-return-line-feed \r\na line that ends in just a line-feed\na line with no ending")
tokenizedBuffer = new TokenizedBuffer({buffer})
atom.config.set('editor.showInvisibles', true)
tokenizedBuffer.setInvisibles(cr: 'R', eol: 'N')
fullyTokenize(tokenizedBuffer)
expect(tokenizedBuffer.lineForScreenRow(0).endOfLineInvisibles).toEqual ['R', 'N']
expect(tokenizedBuffer.lineForScreenRow(1).endOfLineInvisibles).toEqual ['N']
# Lines ending in soft wraps get no invisibles
[left, right] = tokenizedBuffer.lineForScreenRow(0).softWrapAt(20)
expect(left.endOfLineInvisibles).toBe null
expect(right.endOfLineInvisibles).toEqual ['R', 'N']
tokenizedBuffer.setInvisibles(cr: 'R', eol: false)
expect(tokenizedBuffer.lineForScreenRow(0).endOfLineInvisibles).toEqual ['R']
expect(tokenizedBuffer.lineForScreenRow(1).endOfLineInvisibles).toEqual []
describe "leading and trailing whitespace", ->
beforeEach ->
buffer = atom.project.bufferForPathSync('sample.js')
tokenizedBuffer = new TokenizedBuffer({buffer})
fullyTokenize(tokenizedBuffer)
it "sets ::hasLeadingWhitespace to true on tokens that have leading whitespace", ->
it "sets ::hasLeadingWhitespace to true and assigns ::firstNonWhitespaceIndex on tokens that have leading whitespace", ->
expect(tokenizedBuffer.lineForScreenRow(0).tokens[0].hasLeadingWhitespace).toBe false
expect(tokenizedBuffer.lineForScreenRow(0).tokens[0].firstNonWhitespaceIndex).toBe null
expect(tokenizedBuffer.lineForScreenRow(1).tokens[0].hasLeadingWhitespace).toBe true
expect(tokenizedBuffer.lineForScreenRow(1).tokens[0].firstNonWhitespaceIndex).toBe 2
expect(tokenizedBuffer.lineForScreenRow(1).tokens[1].hasLeadingWhitespace).toBe false
expect(tokenizedBuffer.lineForScreenRow(1).tokens[1].firstNonWhitespaceIndex).toBe null
expect(tokenizedBuffer.lineForScreenRow(2).tokens[0].hasLeadingWhitespace).toBe true
expect(tokenizedBuffer.lineForScreenRow(2).tokens[0].firstNonWhitespaceIndex).toBe 2
expect(tokenizedBuffer.lineForScreenRow(2).tokens[1].hasLeadingWhitespace).toBe true
expect(tokenizedBuffer.lineForScreenRow(2).tokens[1].firstNonWhitespaceIndex).toBe 2
expect(tokenizedBuffer.lineForScreenRow(2).tokens[2].hasLeadingWhitespace).toBe false
expect(tokenizedBuffer.lineForScreenRow(2).tokens[2].firstNonWhitespaceIndex).toBe null
# The 4th token *has* leading whitespace, but isn't entirely whitespace
buffer.insert([5, 0], ' ')
expect(tokenizedBuffer.lineForScreenRow(5).tokens[3].hasLeadingWhitespace).toBe true
expect(tokenizedBuffer.lineForScreenRow(5).tokens[3].firstNonWhitespaceIndex).toBe 1
expect(tokenizedBuffer.lineForScreenRow(5).tokens[4].hasLeadingWhitespace).toBe false
expect(tokenizedBuffer.lineForScreenRow(5).tokens[4].firstNonWhitespaceIndex).toBe null
# Lines that are *only* whitespace are not considered to have leading whitespace
buffer.insert([10, 0], ' ')
expect(tokenizedBuffer.lineForScreenRow(10).tokens[0].hasLeadingWhitespace).toBe false
expect(tokenizedBuffer.lineForScreenRow(10).tokens[0].firstNonWhitespaceIndex).toBe null
it "sets ::hasTrailingWhitespace to true on tokens that have trailing whitespace", ->
it "sets ::hasTrailingWhitespace to true and assigns ::firstTrailingWhitespaceIndex on tokens that have trailing whitespace", ->
buffer.insert([0, Infinity], ' ')
expect(tokenizedBuffer.lineForScreenRow(0).tokens[11].hasTrailingWhitespace).toBe false
expect(tokenizedBuffer.lineForScreenRow(0).tokens[11].firstTrailingWhitespaceIndex).toBe null
expect(tokenizedBuffer.lineForScreenRow(0).tokens[12].hasTrailingWhitespace).toBe true
expect(tokenizedBuffer.lineForScreenRow(0).tokens[12].firstTrailingWhitespaceIndex).toBe 0
# The last token *has* trailing whitespace, but isn't entirely whitespace
buffer.setTextInRange([[2, 39], [2, 40]], ' ')
expect(tokenizedBuffer.lineForScreenRow(2).tokens[14].hasTrailingWhitespace).toBe false
expect(tokenizedBuffer.lineForScreenRow(2).tokens[14].firstTrailingWhitespaceIndex).toBe null
expect(tokenizedBuffer.lineForScreenRow(2).tokens[15].hasTrailingWhitespace).toBe true
console.log tokenizedBuffer.lineForScreenRow(2).tokens[15]
expect(tokenizedBuffer.lineForScreenRow(2).tokens[15].firstTrailingWhitespaceIndex).toBe 6
# Lines that are *only* whitespace are considered to have trailing whitespace
buffer.insert([10, 0], ' ')
expect(tokenizedBuffer.lineForScreenRow(10).tokens[0].hasTrailingWhitespace).toBe true
expect(tokenizedBuffer.lineForScreenRow(10).tokens[0].firstTrailingWhitespaceIndex).toBe 0
it "only marks trailing whitespace on the last segment of a soft-wrapped line", ->
buffer.insert([0, Infinity], ' ')
@@ -627,8 +684,20 @@ describe "TokenizedBuffer", ->
[segment1, segment2] = tokenizedLine.softWrapAt(16)
expect(segment1.tokens[5].value).toBe ' '
expect(segment1.tokens[5].hasTrailingWhitespace).toBe false
expect(segment1.tokens[5].firstTrailingWhitespaceIndex).toBe null
expect(segment2.tokens[6].value).toBe ' '
expect(segment2.tokens[6].hasTrailingWhitespace).toBe true
expect(segment2.tokens[6].firstTrailingWhitespaceIndex).toBe 0
it "sets leading and trailing whitespace correctly on a line with invisible characters that is copied", ->
buffer.setText(" \t a line with tabs\tand \tspaces \t ")
tokenizedBuffer.setInvisibles(space: 'S', tab: 'T')
fullyTokenize(tokenizedBuffer)
line = tokenizedBuffer.lineForScreenRow(0).copy()
expect(line.tokens[0].hasLeadingWhitespace).toBe true
expect(line.tokens[line.tokens.length - 1].hasTrailingWhitespace).toBe true
describe "indent level", ->
beforeEach ->
+2 -1
Ver Arquivo
@@ -113,6 +113,7 @@ describe "Window", ->
expect(atom.state.project).toEqual projectState
expect(atom.saveSync).toHaveBeenCalled()
describe ".removeEditorWindow()", ->
it "unsubscribes from all buffers", ->
waitsForPromise ->
atom.workspace.open("sample.js")
@@ -123,7 +124,7 @@ describe "Window", ->
pane.splitRight(pane.copyActiveItem())
expect(atom.workspaceView.find('.editor').length).toBe 2
atom.unloadEditorWindow()
atom.removeEditorWindow()
expect(buffer.getSubscriptionCount()).toBe 0
+2 -3
Ver Arquivo
@@ -195,13 +195,12 @@ describe "WorkspaceView", ->
atom.workspaceView.height(200)
atom.workspaceView.attachToDom()
rightEditorView = atom.workspaceView.getActiveView()
rightEditorView.getEditor().setText("\t ")
rightEditorView.getEditor().setText("\t \n")
leftEditorView = rightEditorView.splitLeft()
expect(rightEditorView.find(".line:first").text()).toBe " "
expect(leftEditorView.find(".line:first").text()).toBe " "
{invisibles} = rightEditorView.component.state
{space, tab, eol} = invisibles
{space, tab, eol} = atom.config.get('editor.invisibles')
withInvisiblesShowing = "#{tab} #{space}#{space}#{eol}"
atom.workspaceView.trigger "window:toggle-invisibles"
+18 -11
Ver Arquivo
@@ -156,7 +156,7 @@ class Atom extends Model
@keymaps = new KeymapManager({configDirPath, resourcePath})
@keymap = @keymaps # Deprecated
@packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode})
@themes = new ThemeManager({packageManager: @packages, configDirPath, resourcePath})
@themes = new ThemeManager({packageManager: @packages, configDirPath, resourcePath, safeMode})
@contextMenu = new ContextMenuManager(devMode)
@menu = new MenuManager({resourcePath})
@clipboard = new Clipboard()
@@ -311,11 +311,6 @@ class Atom extends Model
@requireUserInitScript()
@menu.update()
$(window).on 'unload', =>
$(document.body).css('visibility', 'hidden')
@unloadEditorWindow()
false
@displayWindow()
unloadEditorWindow: ->
@@ -327,13 +322,18 @@ class Atom extends Model
@packages.deactivatePackages()
@state.packageStates = @packages.packageStates
@saveSync()
@workspaceView.remove()
@workspaceView = null
@project.destroy()
@windowEventHandler?.unsubscribe()
@keymaps.destroy()
@windowState = null
removeEditorWindow: ->
return if not @project and not @workspaceView
@workspaceView?.remove()
@workspaceView = null
@project?.destroy()
@project = null
@windowEventHandler?.unsubscribe()
loadThemes: ->
@themes.load()
@@ -451,6 +451,7 @@ class Atom extends Model
center: ->
ipc.send('call-window-method', 'center')
# Schedule the window to be shown and focused on the next tick.
#
# This is done in a next tick to prevent a white flicker from occurring
@@ -470,6 +471,12 @@ class Atom extends Model
app.emit('will-exit')
remote.process.exit(status)
setDocumentEdited: (edited) ->
ipc.send('call-window-method', 'setDocumentEdited', edited)
setRepresentedFilename: (filename) ->
ipc.send('call-window-method', 'setRepresentedFilename', filename)
# Public: Is the current window in development mode?
inDevMode: ->
@getLoadSettings().devMode
+7 -4
Ver Arquivo
@@ -135,7 +135,7 @@ class AtomApplication
# Registers basic application commands, non-idempotent.
handleEvents: ->
@on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: global.devResourcePath)
@on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: global.devResourcePath, safeMode: @focusedWindow()?.safeMode)
@on 'application:run-benchmarks', -> @runBenchmarks()
@on 'application:quit', -> app.quit()
@on 'application:new-window', -> @openPath(windowDimensions: @focusedWindow()?.getDimensions())
@@ -387,11 +387,13 @@ class AtomApplication
# Opens up a new {AtomWindow} to run specs within.
#
# options -
# :exitWhenDone - A Boolean that if true, will close the window upon
# :exitWhenDone - A Boolean that, if true, will close the window upon
# completion.
# :resourcePath - The path to include specs from.
# :specPath - The directory to load specs from.
runSpecs: ({exitWhenDone, resourcePath, specDirectory, logFile}) ->
# :safeMode - A Boolean that, if true, won't run specs from ~/.atom/packages
# and ~/.atom/dev/packages, defaults to false.
runSpecs: ({exitWhenDone, resourcePath, specDirectory, logFile, safeMode}) ->
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
resourcePath = @resourcePath
@@ -402,7 +404,8 @@ class AtomApplication
isSpec = true
devMode = true
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory, logFile})
safeMode ?= false
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory, logFile, safeMode})
runBenchmarks: ->
try
+1 -1
Ver Arquivo
@@ -20,7 +20,7 @@ class AtomWindow
isSpec: null
constructor: (settings={}) ->
{@resourcePath, pathToOpen, initialLine, initialColumn, @isSpec, @exitWhenDone} = settings
{@resourcePath, pathToOpen, initialLine, initialColumn, @isSpec, @exitWhenDone, @safeMode} = settings
# Normalize to make sure drive letter case is consistent on Windows
@resourcePath = path.normalize(@resourcePath) if @resourcePath
+46 -5
Ver Arquivo
@@ -40,8 +40,6 @@ class BufferedProcess
# containing the exit status (optional).
constructor: ({command, args, options, stdout, stderr, exit}={}) ->
options ?= {}
# Quick hack. Killing @process will only kill cmd.exe, and not the child
# process and will just orphan it. Does not escape ^ (cmd's escape symbol).
# Related to joyent/node#2318
if process.platform is "win32"
# Quote all arguments and escapes inner quotes
@@ -55,7 +53,10 @@ class BufferedProcess
"\"#{arg.replace(/"/g, '\\"')}\""
else
cmdArgs = []
cmdArgs.unshift("\"#{command}\"")
if /\s/.test(command)
cmdArgs.unshift("\"#{command}\"")
else
cmdArgs.unshift(command)
cmdArgs = ['/s', '/c', "\"#{cmdArgs.join(' ')}\""]
cmdOptions = _.clone(options)
cmdOptions.windowsVerbatimArguments = true
@@ -114,8 +115,48 @@ class BufferedProcess
onLines(buffered) if buffered.length > 0
onDone()
# Kill all child processes of the spawned cmd.exe process on Windows.
#
# This is required since killing the cmd.exe does not terminate child
# processes.
killOnWindows: ->
parentPid = @process.pid
cmd = 'wmic'
args = [
'process'
'where'
"(ParentProcessId=#{parentPid})"
'get'
'processid'
]
wmicProcess = ChildProcess.spawn(cmd, args)
wmicProcess.on 'error', -> # ignore errors
output = ''
wmicProcess.stdout.on 'data', (data) -> output += data
wmicProcess.stdout.on 'close', =>
pidsToKill = output.split(/\s+/)
.filter (pid) -> /^\d+$/.test(pid)
.map (pid) -> parseInt(pid)
.filter (pid) -> pid isnt parentPid and 0 < pid < Infinity
for pid in pidsToKill
try
process.kill(pid)
@killProcess()
killProcess: ->
@process?.kill()
@process = null
# Public: Terminate the process.
kill: ->
return if @killed
@killed = true
@process.kill()
@process = null
if process.platform is 'win32'
@killOnWindows()
else
@killProcess()
undefined
+13 -2
Ver Arquivo
@@ -103,8 +103,19 @@ class Config
# Returns the value from Atom's default settings, the user's configuration
# file, or `null` if the key doesn't exist in either.
get: (keyPath) ->
value = _.valueForKeyPath(@settings, keyPath) ? _.valueForKeyPath(@defaultSettings, keyPath)
_.deepClone(value)
value = _.valueForKeyPath(@settings, keyPath)
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
if value?
value = _.deepClone(value)
valueIsObject = _.isObject(value) and not _.isArray(value)
defaultValueIsObject = _.isObject(defaultValue) and not _.isArray(defaultValue)
if valueIsObject and defaultValueIsObject
_.defaults(value, defaultValue)
else
value = _.deepClone(defaultValue)
value
# Public: Retrieves the setting for the given key as an integer.
#
+3 -2
Ver Arquivo
@@ -273,9 +273,10 @@ class Cursor extends Model
# line.
moveToFirstCharacterOfLine: ->
{row, column} = @getScreenPosition()
screenline = @editor.lineForScreenRow(row)
goalColumn = screenline.text.search(/\S/)
bufferRange = @editor.bufferRangeForScreenRange([[row, 0], [row, Infinity]])
screenLineText = @editor.getTextInBufferRange(bufferRange)
goalColumn = screenLineText.search(/\S/)
goalColumn = 0 if goalColumn == column or goalColumn == -1
@setScreenPosition([row, goalColumn])
+6 -3
Ver Arquivo
@@ -38,10 +38,10 @@ class DisplayBuffer extends Model
verticalScrollbarWidth: 15
scopedCharacterWidthsChangeCount: 0
constructor: ({tabLength, @editorWidthInChars, @tokenizedBuffer, buffer}={}) ->
constructor: ({tabLength, @editorWidthInChars, @tokenizedBuffer, buffer, @invisibles}={}) ->
super
@softWrap ?= atom.config.get('editor.softWrap') ? false
@tokenizedBuffer ?= new TokenizedBuffer({tabLength, buffer})
@tokenizedBuffer ?= new TokenizedBuffer({tabLength, buffer, @invisibles})
@buffer = @tokenizedBuffer.buffer
@charWidthsByScope = {}
@markers = {}
@@ -81,7 +81,7 @@ class DisplayBuffer extends Model
params
copy: ->
newDisplayBuffer = new DisplayBuffer({@buffer, tabLength: @getTabLength()})
newDisplayBuffer = new DisplayBuffer({@buffer, tabLength: @getTabLength(), @invisibles})
newDisplayBuffer.setScrollTop(@getScrollTop())
newDisplayBuffer.setScrollLeft(@getScrollLeft())
@@ -340,6 +340,9 @@ class DisplayBuffer extends Model
setTabLength: (tabLength) ->
@tokenizedBuffer.setTabLength(tabLength)
setInvisibles: (@invisibles) ->
@tokenizedBuffer.setInvisibles(@invisibles)
# Deprecated: Use the softWrap property directly
setSoftWrap: (@softWrap) -> @softWrap
+25 -27
Ver Arquivo
@@ -3,6 +3,7 @@ React = require 'react-atom-fork'
{debounce, defaults, isEqualForProperties} = require 'underscore-plus'
scrollbarStyle = require 'scrollbar-style'
{Range, Point} = require 'text-buffer'
grim = require 'grim'
GutterComponent = require './gutter-component'
InputComponent = require './input-component'
@@ -48,10 +49,9 @@ EditorComponent = React.createClass
domPollingPaused: false
render: ->
{focused, showIndentGuide, showInvisibles, showLineNumbers, visible} = @state
{focused, showIndentGuide, showLineNumbers, visible} = @state
{editor, mini, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
maxLineNumberDigits = editor.getLineCount().toString().length
invisibles = if showInvisibles and not mini then @state.invisibles else {}
hasSelection = editor.getSelection()? and !editor.getSelection().isEmpty()
style = {}
@@ -109,10 +109,10 @@ EditorComponent = React.createClass
ref: 'lines',
editor, lineHeightInPixels, defaultCharWidth, lineDecorations, highlightDecorations,
showIndentGuide, renderedRowRange, @pendingChanges, scrollTop, scrollLeft,
@scrollingVertically, scrollHeight, scrollWidth, mouseWheelScreenRow, invisibles,
@scrollingVertically, scrollHeight, scrollWidth, mouseWheelScreenRow,
@visible, scrollViewHeight, @scopedCharacterWidthsChangeCount, lineWidth, @useHardwareAcceleration,
placeholderText, @performedInitialMeasurement, @backgroundColor, cursorPixelRects,
cursorBlinkPeriod, cursorBlinkResumeDelay
cursorBlinkPeriod, cursorBlinkResumeDelay, mini
}
ScrollbarComponent
@@ -186,8 +186,13 @@ EditorComponent = React.createClass
componentWillUnmount: ->
@props.parentView.trigger 'editor:will-be-removed', [@props.parentView]
@unsubscribe()
window.removeEventListener 'resize', @requestHeightAndWidthMeasurement
clearInterval(@domPollingIntervalId)
@domPollingIntervalId = null
@props.editor.destroy()
componentWillReceiveProps: (newProps) ->
@props.editor.setMini(newProps.mini)
componentWillUpdate: ->
wasVisible = @visible
@@ -495,7 +500,7 @@ EditorComponent = React.createClass
'editor:fold-at-indent-level-9': => editor.foldAllAtIndentLevel(8)
'editor:toggle-line-comments': => editor.toggleLineCommentsInSelection()
'editor:log-cursor-scope': => editor.logCursorScope()
'editor:checkout-head-revision': => editor.checkoutHead()
'editor:checkout-head-revision': => atom.project.getRepo()?.checkoutHeadForEditor(editor)
'editor:copy-path': => editor.copyPathToClipboard()
'editor:move-line-up': => editor.moveLineUp()
'editor:move-line-down': => editor.moveLineDown()
@@ -509,19 +514,23 @@ EditorComponent = React.createClass
addCommandListeners: (listenersByCommandName) ->
{parentView} = @props
for command, listener of listenersByCommandName
parentView.command command, listener
addListener = (command, listener) ->
parentView.command command, (event) ->
event.stopPropagation()
listener(event)
addListener(command, listener) for command, listener of listenersByCommandName
return
observeConfig: ->
@subscribe atom.config.observe 'editor.showIndentGuide', @setShowIndentGuide
@subscribe atom.config.observe 'editor.invisibles', @setInvisibles
@subscribe atom.config.observe 'editor.showInvisibles', @setShowInvisibles
@subscribe atom.config.observe 'editor.showLineNumbers', @setShowLineNumbers
@subscribe atom.config.observe 'editor.scrollSensitivity', @setScrollSensitivity
@subscribe atom.config.observe 'editor.useHardwareAcceleration', @setUseHardwareAcceleration
onFocus: ->
@refs.input.focus()
@refs.input.focus() if @isMounted()
onTextInput: (event) ->
event.stopPropagation()
@@ -542,8 +551,7 @@ EditorComponent = React.createClass
selectedLength = inputNode.selectionEnd - inputNode.selectionStart
editor.selectLeft() if selectedLength is 1
editor.insertText(event.data)
inputNode.value = event.data
inputNode.value = event.data if editor.insertText(event.data)
onInputFocused: ->
@@ -937,24 +945,14 @@ EditorComponent = React.createClass
setShowIndentGuide: (showIndentGuide) ->
@setState({showIndentGuide})
# Public: Defines which characters are invisible.
#
# invisibles - An {Object} defining the invisible characters:
# :eol - The end of line invisible {String} (default: `\u00ac`).
# :space - The space invisible {String} (default: `\u00b7`).
# :tab - The tab invisible {String} (default: `\u00bb`).
# :cr - The carriage return invisible {String} (default: `\u00a4`).
# Deprecated
setInvisibles: (invisibles={}) ->
defaults invisibles,
eol: '\u00ac'
space: '\u00b7'
tab: '\u00bb'
cr: '\u00a4'
@setState({invisibles})
grim.deprecate "Use config.set('editor.invisibles', invisibles) instead"
atom.config.set('editor.invisibles', invisibles)
# Deprecated
setShowInvisibles: (showInvisibles) ->
@setState({showInvisibles})
atom.config.set('editor.showInvisibles', showInvisibles)
setShowLineNumbers: (showLineNumbers) ->
@setState({showLineNumbers})
+7 -6
Ver Arquivo
@@ -58,6 +58,12 @@ class EditorView extends View
softWrapAtPreferredLineLength: false
scrollSensitivity: 40
useHardwareAcceleration: true
confirmCheckoutHeadRevision: true
invisibles:
eol: '\u00ac'
space: '\u00b7'
tab: '\u00bb'
cr: '\u00a4'
@nextEditorId: 1
@@ -231,7 +237,7 @@ class EditorView extends View
'editor:fold-at-indent-level-9': => @editor.foldAllAtIndentLevel(8)
'editor:toggle-line-comments': => @toggleLineCommentsInSelection()
'editor:log-cursor-scope': => @logCursorScope()
'editor:checkout-head-revision': => @checkoutHead()
'editor:checkout-head-revision': => atom.project.getRepo()?.checkoutHeadForEditor(@editor)
'editor:copy-path': => @copyPathToClipboard()
'editor:move-line-up': => @editor.moveLineUp()
'editor:move-line-down': => @editor.moveLineDown()
@@ -338,11 +344,6 @@ class EditorView extends View
getPlaceholderText: ->
@placeholderText
# Checkout the HEAD revision of this editor's file.
checkoutHead: ->
if path = @editor.getPath()
atom.project.getRepo()?.checkoutHead(path)
configure: ->
@subscribe atom.config.observe 'editor.showLineNumbers', (showLineNumbers) => @gutter.setShowLineNumbers(showLineNumbers)
@subscribe atom.config.observe 'editor.showInvisibles', (showInvisibles) => @setShowInvisibles(showInvisibles)
+43 -10
Ver Arquivo
@@ -159,13 +159,16 @@ class Editor extends Model
@delegatesProperties '$lineHeightInPixels', '$defaultCharWidth', '$height', '$width',
'$scrollTop', '$scrollLeft', 'manageScrollPosition', toProperty: 'displayBuffer'
constructor: ({@softTabs, initialLine, initialColumn, tabLength, softWrap, @displayBuffer, buffer, registerEditor, suppressCursorCreation}) ->
constructor: ({@softTabs, initialLine, initialColumn, tabLength, softWrap, @displayBuffer, buffer, registerEditor, suppressCursorCreation, @mini}) ->
super
@cursors = []
@selections = []
@displayBuffer ?= new DisplayBuffer({buffer, tabLength, softWrap})
if @shouldShowInvisibles()
invisibles = atom.config.get('editor.invisibles')
@displayBuffer ?= new DisplayBuffer({buffer, tabLength, softWrap, invisibles})
@buffer = @displayBuffer.buffer
@softTabs = @usesSoftTabs() ? @softTabs ? atom.config.get('editor.softTabs') ? true
@@ -186,6 +189,9 @@ class Editor extends Model
@subscribe @$scrollTop, (scrollTop) => @emit 'scroll-top-changed', scrollTop
@subscribe @$scrollLeft, (scrollLeft) => @emit 'scroll-left-changed', scrollLeft
@subscribe atom.config.observe 'editor.showInvisibles', callNow: false, (show) => @updateInvisibles()
@subscribe atom.config.observe 'editor.invisibles', callNow: false, => @updateInvisibles()
atom.workspace?.editorAdded(this) if registerEditor
serializeParams: ->
@@ -281,6 +287,11 @@ class Editor extends Model
# Controls visibility based on the given {Boolean}.
setVisible: (visible) -> @displayBuffer.setVisible(visible)
setMini: (mini) ->
if mini isnt @mini
@mini = mini
@updateInvisibles()
# Set the number of characters that can be displayed horizontally in the
# editor.
#
@@ -435,10 +446,6 @@ class Editor extends Model
# filePath - A {String} path.
saveAs: (filePath) -> @buffer.saveAs(filePath)
checkoutHead: ->
if filePath = @getPath()
atom.project.getRepo()?.checkoutHead(filePath)
# Copies the current file path to the native clipboard.
copyPathToClipboard: ->
if filePath = @getPath()
@@ -629,12 +636,29 @@ class Editor extends Model
# Public: For each selection, replace the selected text with the given text.
#
# Emits: `will-insert-text -> ({text, cancel})` before the text has
# been inserted. Calling `cancel` will prevent the text from being
# inserted.
# Emits: `did-insert-text -> ({text})` after the text has been inserted.
#
# text - A {String} representing the text to insert.
# options - See {Selection::insertText}.
#
# Returns a {Bool} indicating whether or not the text was inserted.
insertText: (text, options={}) ->
options.autoIndentNewline ?= @shouldAutoIndent()
options.autoDecreaseIndent ?= @shouldAutoIndent()
@mutateSelectedText (selection) -> selection.insertText(text, options)
willInsert = true
cancel = -> willInsert = false
@emit('will-insert-text', {cancel, text})
if willInsert
options.autoIndentNewline ?= @shouldAutoIndent()
options.autoDecreaseIndent ?= @shouldAutoIndent()
@mutateSelectedText (selection) =>
range = selection.insertText(text, options)
@emit('did-insert-text', {text, range})
range
else
false
# Public: For each selection, replace the selected text with a newline.
insertNewline: ->
@@ -1934,6 +1958,15 @@ class Editor extends Model
shouldAutoIndent: ->
atom.config.get("editor.autoIndent")
shouldShowInvisibles: ->
not @mini and atom.config.get('editor.showInvisibles')
updateInvisibles: ->
if @shouldShowInvisibles()
@displayBuffer.setInvisibles(atom.config.get('editor.invisibles'))
else
@displayBuffer.setInvisibles(null)
# Public: Batch multiple operations as a single undo/redo step.
#
# Any group of operations that are logically grouped from the perspective of
@@ -2023,7 +2056,7 @@ class Editor extends Model
setScrollRight: (scrollRight) -> @displayBuffer.setScrollRight(scrollRight)
getScrollHeight: -> @displayBuffer.getScrollHeight()
getScrollWidth: (scrollWidth) -> @displayBuffer.getScrollWidth(scrollWidth)
getScrollWidth: -> @displayBuffer.getScrollWidth()
getVisibleRowRange: -> @displayBuffer.getVisibleRowRange()
+22 -1
Ver Arquivo
@@ -1,4 +1,4 @@
{join} = require 'path'
{basename, join} = require 'path'
_ = require 'underscore-plus'
{Emitter, Subscriber} = require 'emissary'
@@ -93,6 +93,27 @@ class Git
@getPathStatus(path)
@subscribe buffer, 'destroyed', => @unsubscribe(buffer)
# Subscribes to editor view event.
checkoutHeadForEditor: (editor) ->
filePath = editor.getPath()
return unless filePath
fileName = basename(filePath)
checkoutHead = =>
editor.buffer.reload() if editor.buffer.isModified()
@checkoutHead(filePath)
if atom.config.get('editor.confirmCheckoutHeadRevision')
atom.confirm
message: 'Confirm Checkout HEAD Revision'
detailedMessage: "Are you sure you want to discard all changes to \"#{fileName}\" since the last Git commit?"
buttons:
OK: checkoutHead
Cancel: null
else
checkoutHead()
# Public: Destroy this `Git` object. This destroys any tasks and subscriptions
# and releases the underlying libgit2 repository handle.
destroy: ->
+19 -27
Ver Arquivo
@@ -22,12 +22,12 @@ LinesComponent = React.createClass
if performedInitialMeasurement
{editor, highlightDecorations, scrollHeight, scrollWidth, placeholderText, backgroundColor} = @props
{lineHeightInPixels, defaultCharWidth, scrollViewHeight, scopedCharacterWidthsChangeCount} = @props
{scrollTop, scrollLeft, cursorPixelRects} = @props
{scrollTop, scrollLeft, cursorPixelRects, mini} = @props
style =
height: Math.max(scrollHeight, scrollViewHeight)
width: scrollWidth
WebkitTransform: @getTransform()
backgroundColor: backgroundColor
backgroundColor: if mini then null else backgroundColor
div {className: 'lines', style},
div className: 'placeholder-text', placeholderText if placeholderText?
@@ -60,7 +60,7 @@ LinesComponent = React.createClass
shouldComponentUpdate: (newProps) ->
return true unless isEqualForProperties(newProps, @props,
'renderedRowRange', 'lineDecorations', 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth',
'scrollTop', 'scrollLeft', 'showIndentGuide', 'scrollingVertically', 'invisibles', 'visible',
'scrollTop', 'scrollLeft', 'showIndentGuide', 'scrollingVertically', 'visible',
'scrollViewHeight', 'mouseWheelScreenRow', 'scopedCharacterWidthsChangeCount', 'lineWidth', 'useHardwareAcceleration',
'placeholderText', 'performedInitialMeasurement', 'backgroundColor', 'cursorPixelRects'
)
@@ -82,7 +82,7 @@ LinesComponent = React.createClass
return unless performedInitialMeasurement
@clearScreenRowCaches() unless prevProps.lineHeightInPixels is @props.lineHeightInPixels
@removeLineNodes() unless isEqualForProperties(prevProps, @props, 'showIndentGuide', 'invisibles')
@removeLineNodes() unless isEqualForProperties(prevProps, @props, 'showIndentGuide')
@updateLines(@props.lineWidth isnt prevProps.lineWidth)
@measureCharactersInNewLines() if visible and not scrollingVertically
@@ -170,34 +170,30 @@ LinesComponent = React.createClass
lineHTML
buildEmptyLineInnerHTML: (line) ->
{showIndentGuide, invisibles} = @props
{cr, eol} = invisibles
{indentLevel, tabLength} = line
{showIndentGuide} = @props
{indentLevel, tabLength, endOfLineInvisibles} = line
if showIndentGuide and indentLevel > 0
invisiblesToRender = []
invisiblesToRender.push(cr) if cr? and line.lineEnding is '\r\n'
invisiblesToRender.push(eol) if eol?
invisibleIndex = 0
lineHTML = ''
for i in [0...indentLevel]
lineHTML += "<span class='indent-guide'>"
for j in [0...tabLength]
if invisible = invisiblesToRender.shift()
if invisible = endOfLineInvisibles?[invisibleIndex++]
lineHTML += "<span class='invisible-character'>#{invisible}</span>"
else
lineHTML += ' '
lineHTML += "</span>"
while invisiblesToRender.length
lineHTML += "<span class='invisible-character'>#{invisiblesToRender.shift()}</span>"
while invisibleIndex < endOfLineInvisibles?.length
lineHTML += "<span class='invisible-character'>#{line.endOfLineInvisibles[invisibleIndex++]}</span>"
lineHTML
else
@buildEndOfLineHTML(line, @props.invisibles) or '&nbsp;'
@buildEndOfLineHTML(line) or '&nbsp;'
buildLineInnerHTML: (line) ->
{invisibles, mini, showIndentGuide, invisibles} = @props
{mini, showIndentGuide} = @props
{tokens, text} = line
innerHTML = ""
@@ -207,23 +203,19 @@ LinesComponent = React.createClass
for token in tokens
innerHTML += @updateScopeStack(scopeStack, token.scopes)
hasIndentGuide = not mini and showIndentGuide and (token.hasLeadingWhitespace or (token.hasTrailingWhitespace and lineIsWhitespaceOnly))
innerHTML += token.getValueAsHtml({invisibles, hasIndentGuide})
innerHTML += token.getValueAsHtml({hasIndentGuide})
innerHTML += @popScope(scopeStack) while scopeStack.length > 0
innerHTML += @buildEndOfLineHTML(line, invisibles)
innerHTML += @buildEndOfLineHTML(line)
innerHTML
buildEndOfLineHTML: (line, invisibles) ->
return '' if @props.mini or line.isSoftWrapped()
buildEndOfLineHTML: (line) ->
{endOfLineInvisibles} = line
html = ''
# Note the lack of '?' in the character checks. A user can set the chars
# to an empty string which we will interpret as not-set
if invisibles.cr and line.lineEnding is '\r\n'
html += "<span class='invisible-character'>#{invisibles.cr}</span>"
if invisibles.eol
html += "<span class='invisible-character'>#{invisibles.eol}</span>"
if endOfLineInvisibles?
for invisible in endOfLineInvisibles
html += "<span class='invisible-character'>#{invisible}</span>"
html
updateScopeStack: (scopeStack, desiredScopes) ->
+12
Ver Arquivo
@@ -15,6 +15,7 @@ class MenuManager
@pendingUpdateOperation = null
@template = []
atom.keymaps.on 'bundled-keymaps-loaded', => @loadPlatformItems()
atom.packages.on 'activated', => @sortPackagesMenu()
# Public: Adds the given item definition to the existing template.
#
@@ -130,3 +131,14 @@ class MenuManager
# Get an {Array} of {String} classes for the given element.
classesForElement: (element) ->
element?.classList.toString().split(' ') ? []
sortPackagesMenu: ->
packagesMenu = @template.find ({label}) => @normalizeLabel(label) is 'Packages'
return unless packagesMenu?.submenu?
packagesMenu.submenu.sort (item1, item2) =>
if item1.label and item2.label
@normalizeLabel(item1.label).localeCompare(@normalizeLabel(item2.label))
else
0
@update()
+9 -2
Ver Arquivo
@@ -141,13 +141,17 @@ class PaneView extends View
@activeItem
onActiveItemChanged: (item) =>
@previousActiveItem?.off? 'title-changed', @activeItemTitleChanged
if @previousActiveItem?.off?
@previousActiveItem.off 'title-changed', @activeItemTitleChanged
@previousActiveItem.off 'modified-status-changed', @activeItemModifiedChanged
@previousActiveItem = item
return unless item?
hasFocus = @hasFocus()
item.on? 'title-changed', @activeItemTitleChanged
if item.on?
item.on 'title-changed', @activeItemTitleChanged
item.on 'modified-status-changed', @activeItemModifiedChanged
view = @viewForItem(item)
otherView.hide() for otherView in @itemViews.children().not(view).views()
@itemViews.append(view) unless view.parent().is(@itemViews)
@@ -183,6 +187,9 @@ class PaneView extends View
activeItemTitleChanged: =>
@trigger 'pane:active-item-title-changed'
activeItemModifiedChanged: =>
@trigger 'pane:active-item-modified-status-changed'
viewForItem: (item) ->
return unless item?
if item instanceof $
+10 -10
Ver Arquivo
@@ -10,6 +10,7 @@ class ReactEditorView extends View
@content: (params) ->
attributes = params.attributes ? {}
attributes.class = 'editor react editor-colors'
attributes.tabIndex = -1
@div attributes
focusOnAttach: false
@@ -29,6 +30,7 @@ class ReactEditorView extends View
softWrap: false
tabLength: 2
softTabs: true
mini: mini
props = defaults({@editor, parentView: this}, props)
@component = React.renderComponent(EditorComponent(props), @element)
@@ -55,6 +57,11 @@ class ReactEditorView extends View
lines.addClass(klass)
lines.length > 0
@on 'focus', =>
if @component?
@component.onFocus()
else
@focusOnAttach = true
getEditor: -> @editor
@@ -66,6 +73,7 @@ class ReactEditorView extends View
Object.defineProperty @::, 'lastRenderedScreenRow', get: -> @component.getRenderedRowRange()[1]
Object.defineProperty @::, 'active', get: -> @is(@getPane()?.activeView)
Object.defineProperty @::, 'isFocused', get: -> @component?.state.focused
Object.defineProperty @::, 'mini', get: -> @component?.props.mini
afterAttach: (onDom) ->
return unless onDom
@@ -115,8 +123,9 @@ class ReactEditorView extends View
@find('.lines').prepend(view)
beforeRemove: ->
React.unmountComponentAtNode(@element) if @component.isMounted()
return unless @attached
@attached = false
React.unmountComponentAtNode(@element) if @component.isMounted()
@trigger 'editor:detached', this
# Public: Split the editor view left.
@@ -142,12 +151,6 @@ class ReactEditorView extends View
getPane: ->
@parent('.item-views').parents('.pane').view()
focus: ->
if @component?
@component.onFocus()
else
@focusOnAttach = true
hide: ->
super
@pollComponentDOM()
@@ -169,9 +172,6 @@ class ReactEditorView extends View
pageUp: ->
@editor.pageUp()
getModel: ->
@component?.getModel()
getFirstVisibleScreenRow: ->
@editor.getVisibleRowRange()[0]
+23 -1
Ver Arquivo
@@ -16,7 +16,7 @@ module.exports =
class ThemeManager
Emitter.includeInto(this)
constructor: ({@packageManager, @resourcePath, @configDirPath}) ->
constructor: ({@packageManager, @resourcePath, @configDirPath, @safeMode}) ->
@lessCache = null
@packageManager.registerPackageActivator(this, ['theme'])
@@ -51,6 +51,28 @@ class ThemeManager
themeNames = themeNames.filter (themeName) ->
themeName and typeof themeName is 'string'
# Use a built-in syntax and UI theme when in safe mode since themes
# installed to ~/.atom/packages will not be loaded.
if @safeMode
builtInThemeNames = [
'atom-dark-syntax'
'atom-dark-ui'
'atom-light-syntax'
'atom-light-ui'
'base16-tomorrow-dark-theme'
'base16-tomorrow-light-theme'
'solarized-dark-syntax'
'solarized-light-syntax'
]
themeNames = _.intersection(themeNames, builtInThemeNames)
if themeNames.length is 0
themeNames = ['atom-dark-syntax', 'atom-dark-ui']
else if themeNames.length is 1
if _.endsWith(themeNames[0], '-ui')
themeNames.unshift('atom-dark-syntax')
else
themeNames.push('atom-dark-ui')
# Reverse so the first (top) theme is loaded after the others. We want
# the first/top theme to override later themes in the stack.
themeNames.reverse()
+18 -20
Ver Arquivo
@@ -2,11 +2,7 @@ _ = require 'underscore-plus'
textUtils = require './text-utils'
WhitespaceRegexesByTabLength = {}
LeadingSpaceRegex = /^[ ]+/
TrailingSpaceRegex = /[ ]+$/
EscapeRegex = /[&"'<>]/g
CharacterRegex = /./g
StartCharacterRegex = /^./
StartDotRegex = /^\.?/
WhitespaceRegex = /\S/
@@ -22,6 +18,9 @@ class Token
isHardTab: null
hasLeadingWhitespace: false
hasTrailingWhitespace: false
firstNonWhitespaceIndex: null
firstTrailingWhitespaceIndex: null
hasInvisibleCharacters: false
constructor: ({@value, @scopes, @isAtomic, @bufferDelta, @isHardTab}) ->
@screenDelta = @value.length
@@ -136,14 +135,12 @@ class Token
scopeClasses = scope.split('.')
_.isSubset(targetClasses, scopeClasses)
getValueAsHtml: ({invisibles, hasIndentGuide})->
invisibles ?= {}
getValueAsHtml: ({hasIndentGuide})->
if @isHardTab
classes = 'hard-tab'
classes += ' indent-guide' if hasIndentGuide
classes += ' invisible-character' if invisibles.tab
value = if invisibles.tab then @value.replace(StartCharacterRegex, invisibles.tab) else @value
html = "<span class='#{classes}'>#{@escapeString(value)}</span>"
classes += ' invisible-character' if @hasInvisibleCharacters
html = "<span class='#{classes}'>#{@escapeString(@value)}</span>"
else
startIndex = 0
endIndex = @value.length
@@ -151,26 +148,27 @@ class Token
leadingHtml = ''
trailingHtml = ''
if @hasLeadingWhitespace and match = LeadingSpaceRegex.exec(@value)
if @hasLeadingWhitespace
leadingWhitespace = @value.substring(0, @firstNonWhitespaceIndex)
classes = 'leading-whitespace'
classes += ' indent-guide' if hasIndentGuide
classes += ' invisible-character' if invisibles.space
classes += ' invisible-character' if @hasInvisibleCharacters
match[0] = match[0].replace(CharacterRegex, invisibles.space) if invisibles.space
leadingHtml = "<span class='#{classes}'>#{match[0]}</span>"
leadingHtml = "<span class='#{classes}'>#{leadingWhitespace}</span>"
startIndex = @firstNonWhitespaceIndex
startIndex = match[0].length
if @hasTrailingWhitespace
tokenIsOnlyWhitespace = @firstTrailingWhitespaceIndex is 0
trailingWhitespace = @value.substring(@firstTrailingWhitespaceIndex)
if @hasTrailingWhitespace and match = TrailingSpaceRegex.exec(@value)
tokenIsOnlyWhitespace = match[0].length is @value.length
classes = 'trailing-whitespace'
classes += ' indent-guide' if hasIndentGuide and not @hasLeadingWhitespace and tokenIsOnlyWhitespace
classes += ' invisible-character' if invisibles.space
classes += ' invisible-character' if @hasInvisibleCharacters
match[0] = match[0].replace(CharacterRegex, invisibles.space) if invisibles.space
trailingHtml = "<span class='#{classes}'>#{match[0]}</span>"
trailingHtml = "<span class='#{classes}'>#{trailingWhitespace}</span>"
endIndex = match.index
endIndex = @firstTrailingWhitespaceIndex
html = leadingHtml
if @value.length > MaxTokenLength
+18 -14
Ver Arquivo
@@ -19,27 +19,23 @@ class TokenizedBuffer extends Model
invalidRows: null
visible: false
constructor: ({@buffer, @tabLength}) ->
constructor: ({@buffer, @tabLength, @invisibles}) ->
@tabLength ?= atom.config.getPositiveInt('editor.tabLength', 2)
@subscribe atom.syntax, 'grammar-added grammar-updated', (grammar) =>
if grammar.injectionSelector?
@resetTokenizedLines() if @hasTokenForSelector(grammar.injectionSelector)
@retokenizeLines() if @hasTokenForSelector(grammar.injectionSelector)
else
newScore = grammar.getScore(@buffer.getPath(), @buffer.getText())
@setGrammar(grammar, newScore) if newScore > @currentGrammarScore
@on 'grammar-changed grammar-updated', => @resetTokenizedLines()
@on 'grammar-changed grammar-updated', => @retokenizeLines()
@subscribe @buffer, "changed", (e) => @handleBufferChange(e)
@subscribe @buffer, "path-changed", =>
@bufferPath = @buffer.getPath()
@reloadGrammar()
@subscribe @$tabLength.changes, (tabLength) =>
lastRow = @buffer.getLastRow()
@tokenizedLines = @buildPlaceholderTokenizedLinesForRows(0, lastRow)
@invalidateRow(0)
@emit "changed", { start: 0, end: lastRow, delta: 0 }
@subscribe @$tabLength.changes, (tabLength) => @retokenizeLines()
@subscribe atom.config.observe 'editor.tabLength', callNow: false, =>
@setTabLength(atom.config.getPositiveInt('editor.tabLength', 2))
@@ -59,7 +55,7 @@ class TokenizedBuffer extends Model
@unsubscribe(@grammar) if @grammar
@grammar = grammar
@currentGrammarScore = score ? grammar.getScore(@buffer.getPath(), @buffer.getText())
@subscribe @grammar, 'grammar-updated', => @resetTokenizedLines()
@subscribe @grammar, 'grammar-updated', => @retokenizeLines()
@emit 'grammar-changed', grammar
reloadGrammar: ->
@@ -74,11 +70,13 @@ class TokenizedBuffer extends Model
return true if selector.matches(token.scopes)
false
resetTokenizedLines: ->
@tokenizedLines = @buildPlaceholderTokenizedLinesForRows(0, @buffer.getLastRow())
retokenizeLines: ->
lastRow = @buffer.getLastRow()
@tokenizedLines = @buildPlaceholderTokenizedLinesForRows(0, lastRow)
@invalidRows = []
@invalidateRow(0)
@fullyTokenized = false
@emit "changed", {start: 0, end: lastRow, delta: 0}
setVisible: (@visible) ->
@tokenizeInBackground() if @visible
@@ -94,6 +92,11 @@ class TokenizedBuffer extends Model
# tabLength - A {Number} that defines the new tab length.
setTabLength: (@tabLength) ->
setInvisibles: (invisibles) ->
if invisibles isnt @invisibles
@invisibles = invisibles
@retokenizeLines()
tokenizeInBackground: ->
return if not @visible or @pendingChunk or not @isAlive()
@pendingChunk = true
@@ -206,15 +209,16 @@ class TokenizedBuffer extends Model
tokens = [new Token(value: line, scopes: [@grammar.scopeName])]
tabLength = @getTabLength()
indentLevel = @indentLevelForRow(row)
new TokenizedLine({tokens, tabLength, indentLevel})
lineEnding = @buffer.lineEndingForRow(row)
new TokenizedLine({tokens, tabLength, indentLevel, @invisibles, lineEnding})
buildTokenizedTokenizedLineForRow: (row, ruleStack) ->
line = @buffer.lineForRow(row)
lineEnding = @buffer.lineEndingForRow(row)
tabLength = @getTabLength()
indentLevel = @indentLevelForRow(row)
{ tokens, ruleStack } = @grammar.tokenizeLine(line, ruleStack, row is 0)
new TokenizedLine({tokens, ruleStack, tabLength, lineEnding, indentLevel})
{tokens, ruleStack} = @grammar.tokenizeLine(line, ruleStack, row is 0)
new TokenizedLine({tokens, ruleStack, tabLength, lineEnding, indentLevel, @invisibles})
# FIXME: benogle says: These are actually buffer rows as all buffer rows are
# accounted for in @tokenizedLines
+60 -9
Ver Arquivo
@@ -1,10 +1,16 @@
_ = require 'underscore-plus'
NonWhitespaceRegex = /\S/
LeadingWhitespaceRegex = /^\s*/
TrailingWhitespaceRegex = /\s*$/
RepeatedSpaceRegex = /[ ]/g
idCounter = 1
module.exports =
class TokenizedLine
constructor: ({tokens, @lineEnding, @ruleStack, @startBufferColumn, @fold, @tabLength, @indentLevel}) ->
endOfLineInvisibles: null
constructor: ({tokens, @lineEnding, @ruleStack, @startBufferColumn, @fold, @tabLength, @indentLevel, @invisibles}) ->
@startBufferColumn ?= 0
@tokens = @breakOutAtomicTokens(tokens)
@text = @buildText()
@@ -12,6 +18,9 @@ class TokenizedLine
@id = idCounter++
@markLeadingAndTrailingWhitespaceTokens()
if @invisibles
@substituteInvisibleCharacters()
@buildEndOfLineInvisibles() if @lineEnding?
buildText: ->
text = ""
@@ -90,12 +99,14 @@ class TokenizedLine
tokens: leftTokens
startBufferColumn: @startBufferColumn
ruleStack: @ruleStack
invisibles: @invisibles
lineEnding: null
)
rightFragment = new TokenizedLine(
tokens: rightTokens
startBufferColumn: @bufferColumnForScreenColumn(column)
ruleStack: @ruleStack
invisibles: @invisibles
lineEnding: @lineEnding
)
[leftFragment, rightFragment]
@@ -133,15 +144,55 @@ class TokenizedLine
outputTokens
markLeadingAndTrailingWhitespaceTokens: ->
firstNonWhitespacePosition = @text.search(/\S/)
firstTrailingWhitespacePosition = @text.search(/\s*$/)
lineIsWhitespaceOnly = firstTrailingWhitespacePosition is 0
position = 0
for token, i in @tokens
token.hasLeadingWhitespace = position < firstNonWhitespacePosition
firstNonWhitespaceIndex = @text.search(NonWhitespaceRegex)
firstTrailingWhitespaceIndex = @text.search(TrailingWhitespaceRegex)
lineIsWhitespaceOnly = firstTrailingWhitespaceIndex is 0
index = 0
for token in @tokens
if index < firstNonWhitespaceIndex
token.hasLeadingWhitespace = true
token.firstNonWhitespaceIndex = Math.min(index + token.value.length, firstNonWhitespaceIndex - index)
# Only the *last* segment of a soft-wrapped line can have trailing whitespace
token.hasTrailingWhitespace = @lineEnding? and (position + token.value.length > firstTrailingWhitespacePosition)
position += token.value.length
if @lineEnding? and (index + token.value.length > firstTrailingWhitespaceIndex)
token.hasTrailingWhitespace = true
token.firstTrailingWhitespaceIndex = Math.max(0, firstTrailingWhitespaceIndex - index)
index += token.value.length
substituteInvisibleCharacters: ->
invisibles = @invisibles
changedText = false
for token, i in @tokens
if token.isHardTab
if invisibles.tab
token.value = invisibles.tab + token.value.substring(invisibles.tab.length)
token.hasInvisibleCharacters = true
changedText = true
else
if invisibles.space
if token.hasLeadingWhitespace
token.value = token.value.replace LeadingWhitespaceRegex, (leadingWhitespace) ->
leadingWhitespace.replace RepeatedSpaceRegex, invisibles.space
token.hasInvisibleCharacters = true
changedText = true
if token.hasTrailingWhitespace
token.value = token.value.replace TrailingWhitespaceRegex, (leadingWhitespace) ->
leadingWhitespace.replace RepeatedSpaceRegex, invisibles.space
token.hasInvisibleCharacters = true
changedText = true
@text = @buildText() if changedText
buildEndOfLineInvisibles: ->
@endOfLineInvisibles = []
{cr, eol} = @invisibles
switch @lineEnding
when '\r\n'
@endOfLineInvisibles.push(cr) if cr
@endOfLineInvisibles.push(eol) if eol
when '\n'
@endOfLineInvisibles.push(eol) if eol
isComment: ->
for token in @tokens
+9 -6
Ver Arquivo
@@ -23,9 +23,9 @@ class WindowEventHandler
@subscribe ipc, 'context-command', (command, args...) ->
$(atom.contextMenu.activeElement).trigger(command, args...)
@subscribe $(window), 'focus', -> $("body").removeClass('is-blurred')
@subscribe $(window), 'focus', -> document.body.classList.remove('is-blurred')
@subscribe $(window), 'blur', -> $("body").addClass('is-blurred')
@subscribe $(window), 'blur', -> document.body.classList.add('is-blurred')
@subscribe $(window), 'window:open-path', (event, {pathToOpen, initialLine, initialColumn}) ->
unless fs.isDirectorySync(pathToOpen)
@@ -35,13 +35,16 @@ class WindowEventHandler
confirmed = atom.workspaceView?.confirmClose()
atom.hide() if confirmed and not @reloadRequested and atom.getCurrentWindow().isWebViewFocused()
@reloadRequested = false
atom.storeDefaultWindowDimensions()
atom.storeWindowDimensions()
atom.unloadEditorWindow() if confirmed
confirmed
@subscribe $(window), 'blur unload', ->
atom.storeDefaultWindowDimensions()
@subscribe $(window), 'blur', -> atom.storeDefaultWindowDimensions()
@subscribe $(window), 'unload', ->
atom.storeWindowDimensions()
@subscribe $(window), 'unload', -> atom.removeEditorWindow()
@subscribeToCommand $(window), 'window:toggle-full-screen', -> atom.toggleFullScreen()
+15 -5
Ver Arquivo
@@ -110,6 +110,7 @@ class WorkspaceView extends View
atom.project.on 'path-changed', => @updateTitle()
@on 'pane-container:active-pane-item-changed', => @updateTitle()
@on 'pane:active-item-title-changed', '.active.pane', => @updateTitle()
@on 'pane:active-item-modified-status-changed', '.active.pane', => @updateDocumentEdited()
@command 'application:about', -> ipc.send('command', 'application:about')
@command 'application:run-all-specs', -> ipc.send('command', 'application:run-all-specs')
@@ -210,19 +211,28 @@ class WorkspaceView extends View
confirmClose: ->
@panes.confirmClose()
# Updates the application's title, based on whichever file is open.
# Updates the application's title and proxy icon based on whichever file is
# open.
updateTitle: ->
if projectPath = atom.project.getPath()
if item = @getModel().getActivePaneItem()
@setTitle("#{item.getTitle?() ? 'untitled'} - #{projectPath}")
title = "#{item.getTitle?() ? 'untitled'} - #{projectPath}"
@setTitle(title, item.getPath?())
else
@setTitle(projectPath)
@setTitle(projectPath, projectPath)
else
@setTitle('untitled')
# Sets the application's title.
setTitle: (title) ->
# Sets the application's title (and the proxy icon on OS X)
setTitle: (title, proxyIconPath='') ->
document.title = title
atom.setRepresentedFilename(proxyIconPath)
# On OS X, fades the application window's proxy icon when the current file
# has been modified.
updateDocumentEdited: ->
modified = @model.getActivePaneItem()?.isModified?() ? false
atom.setDocumentEdited(modified)
# Get all editor views.
#
+1 -1
Ver Arquivo
@@ -30,7 +30,7 @@
}
.cursors.blink-off .cursor {
visibility: hidden;
opacity: 0;
}
.horizontal-scrollbar {
+4
Ver Arquivo
@@ -43,6 +43,10 @@ div > .inline-block-tight:last-child {
margin-right: 0;
}
.inline-block .inline-block {
vertical-align: top;
}
// Use left margin when it's in a float: right element.
// Sets the margin correctly when inline blocks are hidden and shown.
.pull-right {