Commit Graph

2743 Commits

Author SHA1 Message Date
Kevin Sawicki
047d9525e7 Ignore first modified event in config editor
This event comes from initially setting the text for the current
config value on the editor and was causing the config to be
immediately saved multiple times when opened.
2013-04-30 21:55:43 -07:00
Kevin Sawicki
ca7da8a0da Don't set un-parseable numbers to 0 in the config
Previously if an integer or float field was empty it would
default to zero instead of undefined which made it inconsistent
with string value fields.

Now the config value is only set as a Number when it can be
parsed as one.
2013-04-30 21:36:27 -07:00
Nathan Sobo
693c4f8270 Preserve folds when restoring selections on undo/redo 2013-04-30 18:39:54 -06:00
Nathan Sobo
df08c14aef Restore markers before triggering buffer events
This allows folds to be restored on undo/redo
2013-04-30 18:21:37 -06:00
Nathan Sobo
9086171f45 💄 2013-04-30 18:14:13 -06:00
Nathan Sobo
9aec992693 Hold marker [in]validation events until after buffer change events
For a while, the goal has been to prevent marker update events from
firing until after the buffer change event. But at the same time, we
want all the markers to be updated when the buffer change fires. This
commit irons out some issues for markers that are invalidated or
revalidated by the change, making their behavior consistent with the
rest of marker updates.
2013-04-30 17:37:28 -06:00
Nathan Sobo
2e77f0ed7d Eliminate special behavior for changes straddling start / end of folds
Previously, we were attempting to preserve the fold and adjust in an
intuitive way in the face of changes that straddled the beginning or
the end of the fold. That added complexity… we would have to add a new
marker invalidation strategy to support it and I'm not convinced it's
actually a big deal to destroy folds in the face of straddling changes.
So that's what we do now.
2013-04-30 14:28:42 -06:00
probablycorey
af5392b8ac Add extra padding to the bottom of an editor's vertical scrollbar
This gives us some space when we scroll to the bottom of a file.
Similar to how MacVim works when using the mouse.

Closes #464
2013-04-30 11:52:28 -07:00
probablycorey
471ac4976f Test correct editor in font size spec 2013-04-30 11:52:28 -07:00
probablycorey
16c892caa6 Update click and drag spec
Stop relying on setInterval to trigger the scroll events in the spec. Instead simulate the mouse moving at the top of the screen. I found 
testing the setInterval approach required so much mocking that it 
wasn't worth it.
2013-04-30 11:52:28 -07:00
Nathan Sobo
9f8a07fc27 Fix some edit session specs. The remaining failures are less trivial. 2013-04-30 04:43:28 -06:00
Nathan Sobo
1f9e33d995 WIP: Base folds on markers.
Still a couple of specs failing on this for changes that straddle the
start / end of a fold. We need a new marker invalidation strategy for
these cases.
2013-04-30 04:30:08 -06:00
Nathan Sobo
32178541fe Emit 'destroyed' events from display buffer markers 2013-04-29 21:01:48 -06:00
Nathan Sobo
51e915c423 Replace marker 'observe' methods w/ ordinary 'changed' event 2013-04-29 21:01:48 -06:00
Nathan Sobo
4ca00f7347 Simplify marker events
Instead of marker-added and marker-removed events which are emitted
when markers are created/invalidated/revalidated/destroyed, we now
just have marker-created events that are triggered *only* when markers
are created for the first time. The marker itself emits a 'destroyed'
event when it is destroyed. The marker already notifies observers when
its validation status changes, so that's covered.
2013-04-29 21:01:48 -06:00
Nathan Sobo
b2d34d93ab Emit 'marker-added/removed' events on DisplayBuffer 2013-04-29 21:01:48 -06:00
Nathan Sobo
3a39c92ae4 Emit 'marker-added/removed' events when buffer marker validity changes 2013-04-29 21:01:48 -06:00
Nathan Sobo
883127f0d6 Emit 'marker-added/removed' when buffer markers are created/destroyed 2013-04-29 21:01:48 -06:00
Nathan Sobo
3b52cd018b Reduce documentation threshold
I deleted a bunch of documented methods. I haven't added any new
undocumented methods, but now there are fewer overall documented
methods, which is breaking the docs threshold spec. I don't think it
makes sense to start documenting non-related methods in this branch
right now.
2013-04-29 21:01:48 -06:00
Nathan Sobo
2d1cb8b519 Fix selection spec to to check marker destruction properly 2013-04-29 21:01:47 -06:00
Nathan Sobo
caf34d6a3a EditSession.selectMarker checks if the marker is valid
Also, it returns the selected range if it's valid, and otherwise
returns a falsy value. This has more utility than just true/false.
2013-04-29 21:01:47 -06:00
Nathan Sobo
d466abdc64 Fix DisplayBuffer spec 2013-04-29 21:01:47 -06:00
Nathan Sobo
f4be899ae9 Switch EditSession over to object-oriented markers API 2013-04-29 21:01:47 -06:00
Nathan Sobo
5403bc647a Convert display buffer markers to object-oriented API 2013-04-29 21:01:47 -06:00
Nathan Sobo
482eb6c0de Give TextBuffer an object-oriented marker interface
The previous API revolved around methods on TextBuffer for querying
and manipulating markers based on their id. Now marker creation
methods return marker objects. These are still retrievable by id so
they can be dealt with across serialization boundaries in the future,
but you deal with them directly as objects.
2013-04-29 21:01:47 -06:00
Nathan Sobo
e02e4cd975 Add DisplayBuffer.findMarker[s] 2013-04-29 21:01:47 -06:00
Nathan Sobo
64aaf670ed Add startRow and endRow special attributes to TextBuffer.findMarker[s] 2013-04-29 21:01:46 -06:00
Nathan Sobo
0f0480b79f Add Buffer.findMarker[s], which returns marker[s] matching attributes 2013-04-29 21:01:46 -06:00
Nathan Sobo
df6feab346 Add Range.compare 2013-04-29 21:01:46 -06:00
Corey Johnson
9180060920 Revert "Listen for mouse events on scrollView instead of renderedLines"
You can't listen on scroll view because that makes
it impossible to scroll using the scrollbar

Opens #464

This reverts commit fdae5fd89c.
2013-04-29 15:07:38 -07:00
Corey Johnson
fdae5fd89c Listen for mouse events on scrollView instead of renderedLines
It was not possible to click on the lower part of the last line
when the editor was scrollable and listening for mousedown events on renderedLines.

Closes #464
2013-04-29 14:59:23 -07:00
Corey Johnson
8e218de3e7 💄 2013-04-29 14:59:23 -07:00
Corey Johnson & Kevin Sawicki
0d8a6782b3 Stop tokenizing line when the same rule is pushed more than once
Previously Rails classes would infinitly loop if the Ruby on Rails
grammar was loaded but the Ruby grammar had not been. This occurred
because a rule was continually pushing itself on the stack but never
advancing.

Now if the position does not advance and the last two rules in the
stack have the same scope the last rule is popped and the entire line
is tokenized with the current scopes.

Closes #524 #486
2013-04-29 12:10:40 -07:00
Kevin Sawicki
5a84814e27 Undasherize the namespace when no event exists
This would present the new-window event as "New Window"
instead of "New-window".
2013-04-29 10:49:31 -07:00
Kevin Sawicki
df6809e705 Bind meta-N to open a new untitled editor 2013-04-29 10:27:39 -07:00
Kevin Sawicki
c54766a08a Don't show indent guide in mini editor 2013-04-26 17:31:54 -07:00
probablycorey
9f85ba4f7d Empty editors trigger config to delete the associated config key 2013-04-26 15:36:58 -07:00
Corey Johnson & Nathan Sobo
1b98bf706e Setting value to null/undefined removes key from config 2013-04-26 15:36:58 -07:00
Corey Johnson & Nathan Sobo
c923b561e2 💄 2013-04-26 15:36:57 -07:00
probablycorey
ecad6bc2a8 Don't allow float or int Editor's to have NaN as a value 2013-04-26 15:36:57 -07:00
probablycorey
cedea831f7 Config panel handles binding for Editors 2013-04-26 15:36:57 -07:00
Nathan Sobo
232978ea9d Themes can be disabled by clicking their 'x' icon in the enabled list 2013-04-26 15:36:14 -07:00
Nathan Sobo
ad0bcc3851 Update enabled themes list when config key is updated 2013-04-26 15:36:13 -07:00
Nathan Sobo
b110f430ee Update 'config.themes' config key when enabled themes list is sorted 2013-04-26 15:36:13 -07:00
Nathan Sobo
0d520e9930 Add a package config panel with the list of enabled packages 2013-04-26 15:36:13 -07:00
Nathan Sobo
b70ff1b164 Don't assign window.jQuery in jasmine-jquery.js helper
I wrap it in a function wrapper to ensure that the assignment
`var jQuery` doesn't end up assigning a window global.
2013-04-26 15:36:13 -07:00
Nathan Sobo
5a291e8188 Use bootstrap stacked nav-pills for panels menu in config window 2013-04-26 15:36:12 -07:00
Nathan Sobo
c90579956f Un-f 2013-04-26 15:36:11 -07:00
Nathan Sobo
495230435f Allow packages to be enabled / disabled from general config panel 2013-04-26 15:36:11 -07:00
Nathan Sobo
f0cddf9f32 Serialize the state of the config window on refresh 2013-04-26 15:36:11 -07:00
Nathan Sobo
422d89a7ed Handle checkbox fields in config panel 2013-04-26 15:34:48 -07:00
Nathan Sobo
5e0dd80366 Remove overkill assertions 2013-04-26 15:34:48 -07:00
Nathan Sobo
bb287cb465 Add ConfigPanel superclass that can bind fields to config values
When you give a config field a `name` attribute based on a config key
path, such as 'editor.fontSize', it is automatically kept in sync with
the config value. You can also specify a `type` attribute of 'int' or
'float' to automatically convert the field value to a numeric type.
Specifying a type of 'string' is optional to signal no conversion.
2013-04-26 15:32:47 -07:00
Nathan Sobo
252159afcf Add super basic styling to config view and 2 non-functional panels 2013-04-26 15:32:47 -07:00
Nathan Sobo
6c43fd5c9d Set up dev tools event handler when binding default keys 2013-04-26 15:32:47 -07:00
Nathan Sobo
2f60ffcfce Add ability to add panels to the config view 2013-04-26 15:32:47 -07:00
Nathan Sobo
8980a97895 Add atom.activatePackageConfig, which is called in config windows
This calls an optional `activateConfig` method on the package's main
module, which allows it to add a configuration interface to the
`configView`.
2013-04-26 15:32:47 -07:00
Nathan Sobo
9d2d3d5c00 Rename window methods to distinguish editor window from config window 2013-04-26 15:32:46 -07:00
Nathan Sobo
f62e81bca8 Add config.observeUserConfig 2013-04-26 15:32:46 -07:00
Nathan Sobo
ab1b90804e Add specs for successful calls to .loadUserConfig 2013-04-26 15:31:18 -07:00
Nathan Sobo
9fe264ded4 💄 2013-04-26 15:31:18 -07:00
Nathan Sobo
3a05731f2d Eliminate EditSession references from tokenized-buffer-spec 2013-04-25 17:16:51 -06:00
Nathan Sobo
9c7ff78fc8 Move language-specific integration tests to text-mate-grammar-spec 2013-04-25 17:15:27 -06:00
Nathan Sobo
4fdc9fba63 Eliminate EditSession dependencies in DisplayBuffer spec 2013-04-25 16:18:39 -06:00
Nathan Sobo
0d78098dbf Make TokenizedBuffer select its own grammar, not LanguageMode
This is part of an effort to disentangle LanguageMode, DisplayBuffer,
and TokenizedBuffer. It should be easy to create a DisplayBuffer
without creating an EditSession… let's get the dependencies flowing
in a single direction.
2013-04-25 15:13:00 -06:00
Nathan Sobo
0f623b3d08 Move structural folding logic to LanguageMode
DisplayBuffer should just focus on providing basic support for folding.
Scanning the structure of the code, looking at scopes, etc is more the
domain of the LanguageMode object.
2013-04-25 14:06:53 -06:00
Nathan Sobo
60f945aafd Move structural folding specs to edit-session-spec
Structural folding should really be handled at the edit session level
so that the DisplayBuffer doesn't need access to the LanguageMode. It
should only be concerned with the raw ability to create folds.
2013-04-25 14:06:53 -06:00
Nathan Sobo
ca3b0c97da 💄 getter renames 2013-04-25 14:06:52 -06:00
Kevin Sawicki
875555d933 Rename invisible class to invisible-character
Bootstrap defines this class with visibility: hidden
which we don't want since invisible characters should
be visible.
2013-04-25 10:02:33 -07:00
Kevin Sawicki
2803da2f8b Replace offsUtilscreen with offscreen 2013-04-24 17:59:50 -07:00
Kevin Sawicki
4e8c6e29ad Use @ instead of this. 2013-04-24 17:57:59 -07:00
Corey Johnson & Nathan Sobo
24ce415283 Move event listener calls from resetDisplay to edit
Fixes #140
2013-04-24 11:41:56 -07:00
probablycorey
9cc4c2e5de Allow off to be called before on without error
Previously calling `something.off 'event-name', handler` would throw
an error unless `on` was called first.
2013-04-24 11:41:56 -07:00
Kevin Sawicki
b65e1485a7 Copy folders to ~/.atom directory asynchronously 2013-04-24 10:12:30 -07:00
Kevin Sawicki
2f5a99fac2 Install atom command asynchronously 2013-04-24 10:12:29 -07:00
Corey Johnson & Nathan Sobo
9f235103f8 Add _.spliceWithArray to avoid stack overflows when splicing huge arrays 2013-04-23 11:16:55 -07:00
Kevin Sawicki & Nathan Sobo
125c41a2e2 Support space-separated event names in EventEmitter.on()/off() 2013-04-23 08:39:26 -07:00
Kevin Sawicki & Nathan Sobo
b9ad462c69 Retokenize when grammar with matching injection selector is updated 2013-04-23 08:39:26 -07:00
Kevin Sawicki & Nathan Sobo
0d35943386 Retokenize when grammar with matching injection selector is loaded 2013-04-23 08:39:26 -07:00
Kevin Sawicki
f0cf337857 Support grammars with an injectionSelector
These grammars can now contribute rules to other grammars when
their selector matches the current scope stack.
2013-04-23 08:39:26 -07:00
Kevin Sawicki
63d665e2cb Replace capture groups in pattern names with match 2013-04-23 08:39:25 -07:00
Nathan Sobo
35f0b7b49e Fix #505. Update grammars if any included grammars are updated. 2013-04-22 11:34:03 -06:00
Nathan Sobo
444325893b Allow subscribers to unsubscribe on a per-object basis
This makes use of the new ES6 WeakMap feature, which allows for a hash
map that's keyed by object.
2013-04-22 11:34:03 -06:00
Nathan Sobo
93910201b0 Re-tokenize buffer when its grammar is updated
This can happen if a grammar that the grammar includes is added or
removed from the syntax global.
2013-04-22 11:34:03 -06:00
Nathan Sobo
9204836d70 Update grammars when grammars they include are added/removed
If the Ruby on Rails grammar depends on HTML, but it isn't loaded, its
syntax highlighting won't include HTMl tokens. If we later load HTML,
we should update any buffer with the Rails grammar to reflect the
change. This commit changes grammars to memoize their initial rule and
repository. If an included grammar is added or removed, we clear the
memoized rules and emit a 'grammar-updated' event. Any tokenized
buffer that points to this grammar can then retokenize to reflect the
newly available/unavailable included grammar.
2013-04-22 11:33:59 -06:00
Kevin Sawicki
62c94959e1 Move injections spec to TextMateGrammar spec
This spec was previously in the TokenizeBuffer spec which
required having a PHP fixture and setting up an edit session
to verify a line could be tokenized which was unnecessary.
2013-04-19 10:58:35 -07:00
Kevin Sawicki & Nathan Sobo
1f4febcfaf Ignore child captures of captures with patterns 2013-04-19 10:58:35 -07:00
Kevin Sawicki
c63834924a Support patterns included in captures
Previously only the capture's name was considered when processing
tokens for capture indices.

Now the capture's patterns are matched against the captured region
if they exist.
2013-04-19 10:58:35 -07:00
Kevin Sawicki
9489ec6787 Add specs for & selectors 2013-04-19 10:58:35 -07:00
Kevin Sawicki & Nathan Sobo
1dffb9237a Use the earliest result when both injection and non-injection patterns match 2013-04-19 10:58:34 -07:00
Kevin Sawicki
c2eca1ff99 Add initial support for injection grammars
Build scope selectors and patterns when setting up the grammar
for all entries under the grammar's injection object.

Include the injection patterns in the scanner when the injection's
scope selector matches the current rule stack.
2013-04-19 10:58:34 -07:00
Kevin Sawicki
beeaa01d22 Support space-separated scopes in selector parser 2013-04-19 10:58:33 -07:00
Kevin Sawicki
3e5448b698 Add initial TextMate scope selector parser 2013-04-19 10:58:33 -07:00
Kevin Sawicki
4b48e07f83 Specify cwd instead of cd'ing 2013-04-18 20:41:17 -07:00
Kevin Sawicki
b5474790cb Remove unused imports 2013-04-18 20:18:37 -07:00
Garen Torikian
42290e87f8 80 is good. 2013-04-18 18:51:46 -07:00
Garen Torikian
cabee75f8a 💄 2013-04-18 15:02:22 -07:00
Garen Torikian
0acccc383e Remove test for folder not documented 2013-04-18 13:24:55 -07:00
Garen Torikian
130baf2235 Merge branch 'master' into api/docs 2013-04-17 16:08:18 -07:00
Nathan Sobo
fff4531663 Fix select-list auto-scrolling specs 2013-04-15 20:45:55 -06:00
Nathan Sobo
bc03810589 Set height on image view, not parent
Setting the height of the parent caused #jasmine-content to be tall
for the remainder of the specs
2013-04-15 20:45:55 -06:00
Nathan Sobo
d82daeccee Fix jasmine styling 2013-04-15 20:45:55 -06:00
Garen Torikian
4c56e8bb57 Merge branch 'master' into api/docs 2013-04-14 09:43:06 -07:00
Kevin Sawicki
7b42e975fb Include hidden files when running nak 2013-04-12 11:48:44 -07:00
Kevin Sawicki
4e59605728 Don't bubble move-to-top/bottom events
This will cause the editor to scroll as well when a select
list is a child of an editor such as in the autocomplete view.
2013-04-11 10:39:19 -07:00
Garen Torikian
e0e4936756 Update spec 2013-04-11 02:14:24 -05:00
Kevin Sawicki
1ae878c000 Fire will-be-removed event from beforeRemove() 2013-04-10 17:43:26 -07:00
Garen Torikian
1142ae89aa Update spec 2013-04-10 18:02:13 -05:00
Garen Torikian
9432f9703e Merge master 2013-04-10 15:05:21 -05:00
Garen Torikian
756bb5604f Add API doc spec 2013-04-09 18:03:29 -05:00
Kevin Sawicki
53c3fa8ac8 Bind meta-< to scroll to cursor location 2013-04-09 14:33:36 -07:00
Kevin Sawicki
efb4bdd028 Remove duplicate RootView.eachPane(callback) 2013-04-09 13:36:52 -07:00
Mutwin Kraus
c91de1e515 Merge remote-tracking branch 'origin/master' into vim-core-changes
Conflicts:
	src/app/pane.coffee
2013-04-09 18:52:36 +02:00
Cheng Zhao
3c4966f6a3 Open the file dragged to window. 2013-04-09 15:37:30 +08:00
Kevin Sawicki
09b7fe72eb Detach instead of remove when moved item is the view
Moving an item that extended the jQuery object between panes
was previously wiping out all jQuery data since remove() was being
called on the view item instead of detach().
2013-04-08 18:22:58 -07:00
Kevin Sawicki
d1c9d0ea68 Focus pane after reopening it
Previously the reopened item would not have focus if it was
reopened into a newly appended pane.
2013-04-08 16:54:05 -07:00
Kevin Sawicki
2f67312a80 Don't prompt to save if buffer is opened elsewhere
This corrects a regression where closing an edit session that
is opened somewhere else should not prompt to save since it
won't be lost if closed immediately since it is still open in
another pane.
2013-04-08 16:30:35 -07:00
Kevin Sawicki
7a709b05f3 Support zooming images in/out and resetting 2013-04-08 15:36:43 -07:00
Kevin Sawicki
6ce3f87448 Add initial image viewer
An image session will be opened by project.buildEditSession()
for known image extensions.

Closes #203
2013-04-08 15:36:35 -07:00
Kevin Sawicki
e3b381f638 Add RootView.eachPane(callback) 2013-04-08 13:04:50 -07:00
Kevin Sawicki
c7175c7e5f Return top and left values of 0 when not visible 2013-04-08 13:03:19 -07:00
Kevin Sawicki
b7b4dcda24 Schedule redraw when updating an invisible editor
The redrawOnReattach flag will now be set when update
display is called on an invisible editor so that if the
editor is detached or hidden before the next update was
processed it will be performed when reattached.
2013-04-08 12:50:05 -07:00
Kevin Sawicki
503b1231db Redraw editor when it becomes the active view
Start watching for when the editor becomes the active view
once it is attached and redraw it when it does.
2013-04-08 12:00:25 -07:00
Mutwin Kraus
9041c56ef3 Spec for selectToBeginningOfNextWord 2013-04-08 14:19:28 +02:00
Mutwin Kraus
2445829f83 Specs for moveCursorToBeginningOfNextWord 2013-04-08 14:15:25 +02:00
Cheng Zhao
e0865e8c38 Use node-pathwatcher. 2013-04-07 16:35:35 +08:00
Nathan Sobo
abc5ed5190 Add editor:add-selection-above command 2013-04-05 14:52:35 -06:00
Nathan Sobo
37e16bb163 Clear multiple selections on escape
The binding uses the `!important` selector to ensure that the editor
always gets a chance to clear multiple selections before other bindings
for escape are processed.
2013-04-05 14:52:35 -06:00
Nathan Sobo
7018f33ad7 Allow !important flag in keymap selectors 2013-04-05 14:52:35 -06:00
Nathan Sobo
2efed9f42c Add EditSession.consolidateSelections() 2013-04-05 14:52:30 -06:00
Nathan Sobo
bd58834e7d Merge goal ranges when merging selections 2013-04-05 14:17:21 -06:00
Nathan Sobo
be009e87c2 Skip empty lines when adding selections below empty selections
Unless the selection's column is 0
2013-04-05 14:17:21 -06:00
Nathan Sobo
393cba4d42 Don't skip shorter lines when the adding empty selection below 2013-04-05 14:17:21 -06:00
Nathan Sobo
131df22c11 Skip lines that are too-short when adding non-empty selection below 2013-04-05 14:17:21 -06:00
Nathan Sobo
40d7fcf32c 🙊 2013-04-05 14:17:21 -06:00
Nathan Sobo
f22461e5e8 Clear goal range when selection is modified
Just like the cursor clears its goal column when it is moved in any
way other than vertically, the selection clears its goal range (the
range it will attempt to use when adding a selection below) when it
is changed in any way.
2013-04-05 14:17:20 -06:00
Nathan Sobo
f6bfab5dd7 Don't freak when selections are added & removed before display update
Previously, if a selection was added and removed before the editor got
a chance to update its display, it would try to add a selection view
for the destroyed selection. Now we check the new selections and
cursors to make sure they aren't destroyed before we add views for
them.
2013-04-05 14:17:20 -06:00
Nathan Sobo
31579703f0 Ensure new non-empty selections have an invisible cursor. 2013-04-05 14:17:20 -06:00
Nathan Sobo
af923cca9b Preserve original selection's range when adding selection's below
Just like the cursor tries to stay in its "goal column" when moving
vertically, here we try to keep the same selection even when adding
across shorter lines.
2013-04-05 14:17:20 -06:00
Nathan Sobo
26e53584c1 Add 'editor:add-selection-below' command
It still needs work, but the basic idea is for every selection to
add another another selection over the same column range of the line
below.
2013-04-05 14:17:20 -06:00
Kevin Sawicki
30fb637f86 Add spec for excluding ignored files from Project.scan() 2013-04-05 08:45:00 -07:00
Kevin Sawicki
84107317bb Support opening non-existent files from the CLI
This required changing text-buffer to support having a
path but not underlying file that exists yet.

Now calling RootView.open() with a non-existed path will
open a dirty empty editor to the path and the file will be
created on first save.
2013-04-04 17:08:05 -07:00
Kevin Sawicki
e442dfff11 Support joining editor lines with ctrl-J
This can be used with or without a selection to join one
or more lines with the line below it separated by a space.

Refs #134
2013-04-04 11:07:59 -07:00
Kevin Sawicki
9773751e79 Delete left when meta-backspacing at start of line
Previously EditSession.backspaceToBeginningOfLine() would do nothing
if at the beginning of the line.

Now it selects left and does a delete so it can be used to delete
multiple lines continuously without having to move the cursor.

Refs #134
2013-04-04 09:25:35 -07:00
Corey Johnson & Nathan Sobo
2973a81293 Don't assign text grammar by default. Just use the null grammar. 2013-04-03 18:34:54 -06:00
Corey Johnson & Nathan Sobo
1b56cfb270 LanguageMode switches to a better-matching grammar when it is added 2013-04-03 18:34:54 -06:00
Corey Johnson & Nathan Sobo
16b53d3183 Eliminate syntax.grammarsByFileType hash 2013-04-03 18:34:53 -06:00
Corey Johnson & Nathan Sobo
05d6adc6c7 Change syntax.selectGrammar to choose the highest-scoring grammar
This sets us up to switch to a grammar when it is loaded if it is a
better match for the current file.
2013-04-03 18:34:53 -06:00
Nathan Sobo
ed1c5d3417 Localize grammar reloading / setting to LanguageMode
Previously, logic associated with swapping grammars was a bit
scattered. Now grammar reloading / assignment methods delegate to
LanguageMode directly, and it emits a 'grammar-changed' event when
the grammar changes. Now EditSession and TokenizedBuffer listen for
this event and perform necessary actions for grammar change.
2013-04-03 18:34:53 -06:00
Kevin Sawicki
4f8d51450a Add missing space in expected string 2013-04-03 16:01:17 -07:00
Kevin Sawicki
0b9f6b14ba Put 'atom' in window title when no panes are open
Previously the title would revert to 'index.html' when
focus was gained and no panes were open.
2013-04-03 15:53:07 -07:00
Corey Johnson & Nathan Sobo
d136837c79 Fix version spec 2013-04-03 15:28:43 -07:00
Nathan Sobo
40aa81e9c1 Add required activate method to avoid logging during specs 2013-04-03 12:34:56 -06:00
Nathan Sobo
5d22cff6ad 🙊 2013-04-03 12:33:40 -06:00
Nathan Sobo
930cd9551b 💄 add eof newlines 2013-04-03 12:01:37 -06:00
Nathan Sobo
f03b6207de Make all requires of 'fs-utils' assign to fsUtils var instead of fs 2013-04-03 12:01:37 -06:00
Nathan Sobo
59a5a5bc8f Always pass a hash to TextBuffer.scanInRange iterators
This makes it easy to only assign variables for the information you
need in the iterator. Before, we always forced you to take a match and
a range as the first two arguments even if you weren't using them.
2013-04-03 11:16:49 -06:00
Mutwin Kraus
a9c74762cc Add focusPreviousPane to pane container 2013-04-02 15:24:12 -07:00
Nathan Sobo
1bbc9f61e9 Remove unsaved buffer prompt on reload now that we handle it correctly 2013-04-02 15:45:17 -06:00
Nathan Sobo
dab8c5b53b Assign cachedDiskContents when unsaved buffer is deserialized
This allows the buffer to return to an "unmodified" state if the
unsaved changes are reversed.
2013-04-02 15:45:16 -06:00
Nathan Sobo
3150785db2 Ensure we never deserialize two instances of the same buffer
We might have two edit sessions pointing to the same buffer, for
example if we have a split pane… So when we deserialize a buffer, we
always need to check that we don't already have an instance of that
buffer on the project. If we do, then we've already deserialized it
once so we don't need to worry about the saved text.

We still have a problem when deserializing previously unsaved buffers,
because we can't use the path to identify them.
2013-04-02 15:45:16 -06:00
Nathan Sobo
f531d36060 Condense / cleanup TextBuffer serialization specs
Typically it's fine to test serialization behaviorally. If we can
deserialize the serialized state correctly, then we're generally
happy. We don't need explicit tests on the serialized state… but I
added a couple assertions to ensure we don't write text when we don't
need to. It would have been more correct to just modify the saved
file and verify we load the new state, but it's not worth the hassle.
2013-04-02 15:45:16 -06:00
Nathan Sobo
9efc326ff3 Remove spec that can be covered in text-buffer specs 2013-04-02 15:45:16 -06:00
Nathan Sobo
78211acafd Use project.bufferForPath to build buffers in specs
This reflects the way buffers should always be created in practice. It
registers buffers on project, which will be important when testing
that we always get the same buffer when deserializing a buffer for a
path we've already opened.
2013-04-02 15:45:16 -06:00
Nathan Sobo
40975f15d3 💄 Follow whitespace conventions for specs 2013-04-02 15:45:16 -06:00
Mutwin Kraus
cc87595e4e Serialize TextBuffer inside EditSession serialize 2013-04-02 15:45:16 -06:00
Mutwin Kraus
693d8258ad Preserve buffer contents for unsaved files when reloading 2013-04-02 15:45:16 -06:00
Kevin Sawicki
9a8fd062c4 Throw error instead of string 2013-04-02 14:40:55 -07:00
Kevin Sawicki
07b40265fb Log error when no stack exists 2013-04-02 14:40:30 -07:00
Kevin Sawicki
3cfbbc5d94 Attach to DOM in specs that alter the mini editor
This is now required since populateList() is only
calls when the timeout is fired and the select list
is still on the DOM.
2013-04-02 13:22:46 -07:00
probablycorey
ecb159738f Rename singleTrailingNewline to ensureSingleTrailingNewline 2013-04-01 10:44:34 -07:00
Kevin Sawicki
19162db3ce Clip TextBuffer.characterIndexForPosition() position 2013-03-30 00:47:19 -04:00
Kevin Sawicki
da090b57d4 Use line ending length for mapping positions/characters
Previously the line ending length was hard-coded to one which
would cause TextBuffer.scanInRange() to return incorrect results
since one character per line wasn't being accounted for.

Closes #428
2013-03-30 00:30:54 -04:00
Kevin Sawicki
dc3b26c934 Add missing 't' in spec file name 2013-03-29 23:55:31 -04:00
probablycorey
d3920cdc05 Click and drag on the gutter selects lines correctly
Closes #352
2013-03-29 17:58:27 -07:00
probablycorey
05336dc38c Fix atom.version spec 2013-03-29 15:24:27 -07:00
Corey Johnson & Nathan Sobo
7d9e64a52d Mock getMaxTokensPerLine instead of overwriting member var 2013-03-29 11:22:01 -07:00
Kevin Sawicki
8e9a7355bc Return an empty array when the fs-utils.list() path isn't a directory
This makes the common case of iterating over an array of paths and
listing them cleaner since the return value doesn't need to be checked
before it is iterated over.
2013-03-29 13:44:03 -04:00
Kevin Sawicki
ff471ebf5b 💄 2013-03-28 22:08:53 -04:00
Kevin Sawicki
bd48cfced0 Don't track ctrl-click as the start of a selection
Closes #396
2013-03-28 22:06:56 -04:00
probablycorey
aab50d3c2c Only parse the first 100 tokens of a line
This fixes the UI thread lockup when there is a gigantic line in a
file (like minified js). I took a stab at making line tokeninization
async on the atom/async-single-line-tokenization branch, but it was
still too slow.

Closes #150
2013-03-28 17:14:45 -07:00
Kevin Sawicki
d54f2e6eab Only track selections that start with a left-click
Closes #396
2013-03-27 21:06:56 -04:00
probablycorey
72f57ad993 Remove old grammar view files 2013-03-27 17:34:14 -07:00
probablycorey
fd7772a653 Reset scrollLeft when setSoftWrapColumn is called
When the scroll view is scrolled and overflow-x is set to 
'hidden' the scroll view renders wrong. Setting scrollLeft to 0 fixes
this problem. I'm unhappy with this solution, but it was a
simple way to get the scroll view to update its layout.

Closes #137
2013-03-27 15:13:55 -07:00
probablycorey
a48a52922b Indent soft-wrap spec correctly 2013-03-27 15:13:55 -07:00
Kevin Sawicki
1d84274973 Return existing selections from addSelection()
Previously if a selection was added and then merged
away the selection-added event would still fire even
though the selection was already destroyed.

Now the existing selection that intersects with the
range is returned when the merge destroys the new selection.

Closes #374
2013-03-27 17:59:55 -04:00
probablycorey
a1b82e9dad Allow mini-editors to explicitly set their grammars 2013-03-27 11:00:53 -07:00
Cheng Zhao
b5be1c378a Replace Task's implementation with ProcessTask. 2013-03-27 12:25:54 +08:00
Cheng Zhao
142824ec01 Add test for ProcessTask. 2013-03-27 12:25:54 +08:00
Nathan Sobo
d3fa24be57 Remove scoped-properties when deactivating a TextMate package 2013-03-26 17:35:45 -06:00
Nathan Sobo
6a5ca3805e Spec loading of scoped properties when activating TextMate packages 2013-03-26 17:35:44 -06:00
Nathan Sobo
eef13e7db8 Test that deferred packages don't require their main module
As opposed to asserting that the main module isn't present, which
might not be true if a previous spec required it.
2013-03-26 17:35:44 -06:00
Nathan Sobo
e32d7b1ff1 Remove unused test.tmbundle 2013-03-26 17:35:44 -06:00
Nathan Sobo
1f74b5ccb4 Rename textmate package w/ invalid snippets 2013-03-26 17:35:44 -06:00
Nathan Sobo
a07cd87c2c Move testing of deferred deserializers to atom-spec 2013-03-26 17:35:44 -06:00
Nathan Sobo
2fe057bd9b Move deferred activation specs to atom-spec 2013-03-26 17:35:44 -06:00
Corey Johnson & Nathan Sobo
81d4b764b8 Remove a package's scoped-properties when it is deactivated
Also: don't add the properties until `activate` is called. Previously
we were still adding the properties in the `load` method, which was
wrong.
2013-03-26 17:35:44 -06:00
Corey Johnson & Nathan Sobo
c8ec73d2f0 Allow scoped-properties to be added/removed by name
Also:
  - remove "global" properties
  - clear scoped properties between specs
2013-03-26 17:35:44 -06:00
Corey Johnson & Nathan Sobo
368e10a9f5 Move spec for scoped property loading to atom-spec 2013-03-26 17:35:44 -06:00
Corey Johnson & Nathan Sobo
3c561ef208 💄 2013-03-26 17:35:44 -06:00
Corey Johnson & Nathan Sobo
c8b9622bf4 Move specs for loading config defaults to atom-spec 2013-03-26 17:35:44 -06:00
Corey Johnson & Nathan Sobo
5d822b7305 Remove a package's stylesheets when it is deactivated 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
1e51750b6c Remove a package's keymaps when it is deactivated 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
5410e9368f Add ability to add/remove keymaps by name 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
772787121c Remove atom package grammars on deactivate 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
c1954d869a Add tests for TextMateGrammar@loadSync 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
d37fbd43f1 Test that atom packages load their grammars 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
de7d9bfcb1 Get deactivatePackage specs passing w/ new fixture data 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
8c1f5658be Allow packages to have stylesheet manifests 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
b846a4db98 wip: cleanup package lifecycle specs 2013-03-26 17:35:43 -06:00
Corey Johnson
da016114b6 Add specs for activating and deactivating TextMate packages 2013-03-26 17:35:43 -06:00
Corey Johnson & Nathan Sobo
8437f3ff7f Only load TextMate packages as needed in specs
Also: when a TextMate package is deactivated, remove its grammars
2013-03-26 17:35:42 -06:00
Nathan Sobo
a41e3c1ebb Don't clear loaded packages between specs 2013-03-26 17:35:42 -06:00
Nathan Sobo
bb8b3782b9 Serialize package states independently of RootView
Previously, package specs needed to deactivate the root view to test
their package serialization. Now, specs can just deactivate and then
reactivate the package, relying on serialization infrastructure that's
independent of the lifecycle of the RootView.
2013-03-26 17:35:42 -06:00
Nathan Sobo
f5774972e9 Add atom.deactivatePackage(id)
It serializes the package state to the atom.packageStates hash when
the package is deactivated, which means we will be able to test 
package serialization independent of the overall window lifecycle by
just deactivating and re-activating the package.
2013-03-26 17:35:42 -06:00
Nathan Sobo
e3ddc3f29b Kill window.loadPackage spec helper. We use built-in methods now. 2013-03-26 17:35:42 -06:00
Nathan Sobo
58ef6c6582 Use atom.activatePackage directly in specs 2013-03-26 17:35:42 -06:00
probablycorey
187263173b Only exit specs on exceptions when exitWhenDone is true 2013-03-26 14:57:03 -07:00
probablycorey
60189c0135 exit(1) when spec-bootstrap throws an error 2013-03-26 14:20:03 -07:00
Kevin Sawicki
6d2805d782 Drop extension from requireStylesheet() 2013-03-26 00:15:32 -04:00
Kevin Sawicki
fab5842651 Support requiring stylesheets without an extension
Stylesheets will attempt to be resolved with both css
and less extensions if no extension is included in the
path specified to requireStylesheet().
2013-03-26 00:11:11 -04:00
Kevin Sawicki
513ed3b4b1 Show symlink file icon in tree view 2013-03-25 16:51:39 -04:00
Corey Johnson
ec4bb162c3 Add editor.showLineNumbers config option
Also adds toggle-line-numbers command. Closes #377
2013-03-25 10:38:06 -07:00
Kevin Sawicki
7756f8e86d Show ignored icon in status bar 2013-03-25 12:00:11 -04:00
Kevin Sawicki
0080e09065 Only check for back references in end patterns
Back references can occur in match values but should not
be treated differently when present there since they refer
to groups inside the match.

Close #370
2013-03-24 23:25:00 -04:00
Nathan Sobo
a05405370c Serialize the syntax object's grammar overrides with window state 2013-03-22 17:35:35 -06:00
Corey Johnson & Nathan Sobo
db4420e068 Move grammar overrides to syntax (no serialization yet) 2013-03-22 17:35:35 -06:00
Corey Johnson & Nathan Sobo
dacb00ed67 Simplify grammar selection and its specs 2013-03-22 17:35:34 -06:00
Nathan Sobo
a2f72882d7 Rename grammarForFilePath to selectGrammar
The old name was misleading because it the decision is based on the
file contents in some circumstances.
2013-03-22 17:35:27 -06:00
Nathan Sobo
ab934cfbfb Replace LoadTextMatePackagesTask with async grammar loading 2013-03-22 15:29:07 -06:00
Nathan Sobo
d3ead2a0d1 Update fs.list to use readdirSync and filterExtensions helper 2013-03-22 15:29:07 -06:00
Nathan Sobo
a5dcd71548 Add fs.listAsync 2013-03-22 15:29:07 -06:00
Kevin Sawicki & Nathan Sobo
e23edd02fd Use flexbox to position editor's gutter and scroll view
This removes the need to compute the width of the gutter based
on the line count in the editor and also removes the need to
set the scroll view's left position manually.
2013-03-22 12:47:56 -07:00
Corey Johnson & Nathan Sobo
84fe0a384d Pop grammar rules that result in infinite loops 2013-03-22 11:42:47 -07:00
Kevin Sawicki
712ba2c3fa Clear all syntax subscriptions after spec runs
The global syntax object is reused between specs so
each spec should start off with a clean listener list.
2013-03-21 18:46:08 -07:00
Corey Johnson & Nathan Sobo
1ad5327c99 Ensure we never load saved window in specs 2013-03-21 18:51:32 -06:00
Corey Johnson & Nathan Sobo
f4d339ccac Unify root view state with window state 2013-03-21 18:24:21 -06:00
Kevin Sawicki
f8ffe1c408 Only delete to end row when greater than start row
Closes #442
2013-03-21 17:07:36 -07:00
Corey Johnson & Nathan Sobo
2f3b4b9e5f Move scoped properties out of the grammar file and into a directory
Closes #435
2013-03-21 14:07:32 -07:00
Corey Johnson & Nathan Sobo
0b719bfecf Atom packages can load cson grammars and TextMate packages can't 2013-03-21 13:26:56 -07:00
Kevin Sawicki
77b7e71920 Move jasmine-helper from vendor/ to spec/ 2013-03-20 18:38:19 -07:00
Kevin Sawicki
8668998b1a Move jasmine-focused to spec folder
This JS file was previously loaded in the vendor folder
even though it was internally written.

It has also been converted to CoffeeScript.
2013-03-20 18:36:55 -07:00
Kevin Sawicki
661ef175d5 Remove $native.getPlatform()
process.platform should now be used instead.
2013-03-20 17:51:51 -07:00
Kevin Sawicki
61cc592605 Use absolute paths in Editor.reloadGrammar() specs 2013-03-20 15:04:20 -07:00
Kevin Sawicki & Nathan Sobo
501dc9b76c Merge remote-tracking branch 'origin/master' into cefode
Conflicts:
	native/v8_extensions/native.mm
	spec/app/config-spec.coffee
	spec/app/window-spec.coffee
	spec/spec-helper.coffee
	spec/stdlib/fs-utils-spec.coffee
	src/app/atom-package.coffee
	src/app/config.coffee
	src/app/window.coffee
	src/packages/fuzzy-finder/lib/load-paths-handler.coffee
	src/packages/markdown-preview/lib/markdown-preview-view.coffee
	src/packages/tree-view/spec/tree-view-spec.coffee
	src/stdlib/require.coffee
2013-03-20 10:46:50 -06:00
Corey Johnson & Nathan Sobo
10f405f61f Create preview list Dom elements only when needed 2013-03-19 11:30:48 -07:00
Nathan Sobo
875fbba024 Measure spec suite require time 2013-03-15 09:09:56 -06:00
Nathan Sobo
a1882ffd1f Move "GitHub" special-case to _.capitalize. Add specs. 2013-03-14 11:35:06 -06:00
Nathan Sobo
634117ed66 Make $.fn.document always take event name / doc string args
It's simpler and we don't use the other syntax right now.
2013-03-14 11:34:28 -06:00
Nathan Sobo
25839c5cf5 Add spec coverage for $.fn.command 2013-03-14 11:25:33 -06:00