Commit Graph

1600 Commits

Author SHA1 Message Date
Kevin Sawicki & Nathan Sobo
2b49a04227 Return a cloned object from config.get()
This prevents mutations to the values of the default settings.
2013-05-16 10:29:08 -07:00
Kevin Sawicki
61675c2e77 Install apm command when Atom starts
This changes the command installation to use symlinks instead
of copying over the contents of the file.
2013-05-15 10:29:27 -07:00
Nathan Sobo
aefb84cdeb Don't modify uri's with a scheme prefix in Project.resolve 2013-05-14 20:55:14 -06:00
Nathan Sobo
aa86362a0a Add Project@registerOpener(fn) to register custom openers on project
Now packages can register custom handlers for different kinds of file
paths. If the function you register returns a resource for the given
path, it will be returned from Project.open instead of an EditSession.
2013-05-14 20:23:25 -06:00
Nathan Sobo
6104927cb6 Rename Project.buildEditSession -> Project.open 2013-05-14 20:03:53 -06:00
Kevin Sawicki
2f54cb4c22 Use season module internally 2013-05-14 11:58:34 -07:00
Kevin Sawicki
b8ee3187ec doc: task instead of web worker 2013-05-13 17:35:51 -07:00
probablycorey
f74842cd4c Use new ruby scopes in TextMateGrammar spec 2013-05-13 16:51:30 -07:00
probablycorey
423b133e75 Comments can't increase the indent level of the next line 2013-05-13 14:28:16 -07:00
probablycorey
eb25d2e6a8 TokenizedBuffer.tokenForPosition(position) now works correctly
It was previously returning the wrong token at token boundaries.
2013-05-13 14:28:16 -07:00
probablycorey
eae06b62bc Spec 💄 2013-05-13 14:28:16 -07:00
probablycorey
49aeef99b6 Add config option editor.normalizeIndentOnPaste 2013-05-13 14:28:16 -07:00
probablycorey
8e37d2ada6 Turn auto-indent on for all 'newline' specs 2013-05-13 14:28:16 -07:00
probablycorey
7513fe9c69 Set editor.autoIndent to true in specs 2013-05-13 14:28:16 -07:00
probablycorey
992f520698 Normalize pasted text when there is an indent basis 2013-05-13 14:28:16 -07:00
probablycorey
b23e1d3d52 In specs, use local copyText function to put text on the pasteboard 2013-05-13 14:28:16 -07:00
probablycorey
dd53539799 Moving auto-indent specs to appropriate places 2013-05-13 14:28:15 -07:00
probablycorey
93b1ce53c0 Rename autoDecreaseIndentForRow to autoDecreaseIndentForBufferRow 2013-05-13 14:28:15 -07:00
probablycorey
c34db290e4 Only indent the line following a '\n' not the line preceding it 2013-05-13 14:28:15 -07:00
probablycorey
9d2b7875b9 💄 2013-05-13 14:28:15 -07:00
probablycorey
38d4e3a097 Move all auto-indent specs to the auto-indent describe block 2013-05-13 14:28:15 -07:00
probablycorey
c03d44da00 Add autoIndentNewline and autoDecreaseIndent options to insertText
insertText now takes these options:
* autoIndent will auto indent all inserted text based
* autoIndentNewline will indent a line when a '\n' is inserted
* autoDecreaseIndent will decrease the indent if the line matches a 
decreaseIndent pattern (such as a `}` in javavascript)
2013-05-13 14:28:15 -07:00
probablycorey
9713bc8c02 💄 2013-05-13 14:28:15 -07:00
probablycorey
7f0b2c54f3 editor.autoIndentOnPaste will auto indent every pasted line
I've removed normalizeLines and its tests. They will be added back in
a later commit.
2013-05-13 14:28:14 -07:00
probablycorey
533b11f991 💄 2013-05-13 14:28:14 -07:00
Nathan Sobo
b4dec8ccbb In Editor.updateRenderedLines, cap renderFrom to the last screen row
If we remove a large number of screen lines when we are scrolled down,
the current @firstRenderedScreenRow may end up being larger than the
number of screen rows we now have. Setting renderFrom to the
@firstRenderedScreenRow in this case was causing the renderFrom to be
larger than the renderTo, which was causing problems downstream with
the new mapping code.
2013-05-10 13:20:43 -06:00
Nathan Sobo
b4c95d4fc9 Merge adjacent isomorphic regions after adding new regions 2013-05-10 13:20:42 -06:00
Nathan Sobo
d9c258f27e Handle new regions overlapping screen wise but not buffer wise 2013-05-10 13:20:42 -06:00
Nathan Sobo
4a56cc3693 Kick docs threshold down again because I removed public methods 2013-05-10 13:20:42 -06:00
Nathan Sobo
d3cb001d65 Use RowMap instead of LineMap in DisplayBuffer 2013-05-10 13:20:42 -06:00
Nathan Sobo
d7914d2c54 Ensure row map applies negative deltas only after the given start row 2013-05-10 13:20:42 -06:00
Nathan Sobo
9849c62d80 Properly handle regions that straddle existing regions
When we're creating folds that contain other folds, we'll need the
region based on the new fold's row mapping to overwrite the regions
from the old folds. This commit ensures that the new region cleanly
slots in, replacing any regions it completely contains and splitting
regions that it only partially overlaps.
2013-05-10 13:20:42 -06:00
Nathan Sobo
3c630fb7f4 Rename mapping -> region within RowMap 2013-05-10 13:20:42 -06:00
Nathan Sobo
55f0b6a1f8 Replace existing regions when inserting a mapping that surrounds them 2013-05-10 13:20:42 -06:00
Nathan Sobo
1b21fdda3b Don't throw errors when applying screen deltas after the last mapping 2013-05-10 13:20:41 -06:00
Nathan Sobo
c17d6ba487 Adjust multiple mappings if needed when applying screen deltas
If there are multiple mappings following the start row of the delta
that span fewer screen rows than the delta, we collapse mappings to 0
screen rows until we have removed the number of rows specified by the
delta.

Expanding positive deltas expands the first mapping following the
start row as it did previously.
2013-05-10 13:20:41 -06:00
Nathan Sobo
c6ff7e8934 Inserting a mapping within an existing mapping preserves its shape
Inserting a mapping should never change the position of any existing
mappings on screen or in the buffer. It's simply a statement about a
range of rows in the buffer mapping to a range of existing rows on
screen, but shouldn't add or remove any rows. Adding and removing rows
on screen or in the buffer is the job of the applyBufferDelta and
applyScreenDelta methods.
2013-05-10 13:20:41 -06:00
Nathan Sobo
1895e8143d Allow the screen row count of N-screen:1-buffer mappings to be updated 2013-05-10 13:20:41 -06:00
Nathan Sobo
5c74a02688 Add row map specs for mappings of N screen rows to 1 buffer row 2013-05-10 13:20:41 -06:00
Nathan Sobo
2f900e11ed Add RowMap.bufferRowRangeForScreenRow 2013-05-10 13:20:41 -06:00
Nathan Sobo
32b40fe1ad Eliminate dummy implementation of bufferRowRangeForScreenRow 2013-05-10 13:20:41 -06:00
Nathan Sobo
9a12b170f6 Allow insertion of multiple buffer row range mappings 2013-05-10 13:20:41 -06:00
Nathan Sobo
9f4b594bd0 Start on RowMap 2013-05-10 13:20:41 -06:00
Nathan Sobo
e8e0d5dd02 Fix regression: folds can be destroyed by clicking them 2013-05-06 08:27:43 -06:00
Nathan Sobo
3e937e9811 Merge remote-tracking branch 'origin/master' into know-when-to-foldem
Conflicts:
	src/app/buffer-marker.coffee
	src/app/cursor.coffee
	src/app/display-buffer-marker.coffee
	src/app/display-buffer.coffee
	src/app/edit-session.coffee
	src/app/fold.coffee
	src/app/line-map.coffee
	src/app/range.coffee
	src/app/selection.coffee
	src/app/text-buffer.coffee
2013-05-03 18:29:52 -06:00
Nathan Sobo
ebfd8ca4c3 Give docs errors a better failure message 2013-05-03 17:34:48 -06:00
Corey Johnson & Nathan Sobo
da938d8212 Fix edit session specs concerning delete/backspace + folds 2013-05-03 17:24:08 -06:00
probablycorey
c13b291c64 Update config panel spec 2013-05-02 12:05:56 -07:00
probablycorey
70191ea368 Don't store config values that equal their default config value
If 'foo' has not been set and has a default value of 1, 
config.set('foo', 1) will not store the 1.

If 'foo' has been set to X and has a default value of 1, 
config.set('foo', 1) will remove 'foo' from config
2013-05-02 12:05:56 -07:00
Kevin Sawicki
10ca03f238 Don't show indent guide in truly trailing whitespace
Lines that are all whitespace are considered trailing
whitespace and should display the indent guide.

But lines with leading and trailing whitespace should never
have the indent guide rendered in the trailing area.
2013-05-02 11:44:49 -07:00
Kevin Sawicki
ee621bcace Bind link click handler in window.handleEvents() 2013-05-01 22:18:39 -07:00
Kevin Sawicki
4dce9d659f Open http/https links in an external browser
Listen for all links being clicked and open any http/https
hrefs by spawning a call to the 'open' command.

Closes #531
2013-05-01 21:36:36 -07:00
Kevin Sawicki
35cf96e15f Render empty line invisibles at correct position
End of line invisibles are not rendered at the correct
position for empty lines instead of always after the
last indent guide span.

Closes #456
2013-05-01 20:54:09 -07:00
Nathan Sobo
69300e0766 Make Buffer.transact restore marker ranges on undo/redo of transaction
We no longer need to restore selection ranges before and after
transactions now because selections are based on markers so they go
along for the ride for free. This allows us to delegate directly to
Buffer.transact from EditSession.
2013-05-01 18:38:40 -06:00
Nathan Sobo
988f4da6e1 Always restore marker ranges on undo/redo, even for valid markers 2013-05-01 17:32:39 -06:00
Nathan Sobo
f48ee846e9 💄 2013-05-01 17:23:21 -06:00
Nathan Sobo
a9c599abeb Isolate folds on a per-display-buffer basis
Creating a fold in one pane now has no effect on an edit session
for the same buffer in another pane. Before they were polluting each
other by sharing the same fold markers.
2013-05-01 16:24:32 -06:00
probablycorey
0be166bb59 Remove the bottomPaddingInLines from editor 2013-05-01 13:54:37 -07:00
probablycorey
cb2d24baca Listen for clicks outside of the render lines on the underlayer 2013-05-01 13:54:37 -07:00
Kevin Sawicki
536beb0d40 Support setting number fields to 0
Previously entering 0 would end up as '0' in the config
value instead of as a numeric value.
2013-04-30 23:10:22 -07:00
Kevin Sawicki
986e5f9c7a Default to 80 when editor.preferredLineLength <= 0
Previously any non-null value would be used as the target
column in the wrap guide and autoflow packages when really
80 should have been used if the value was non-postive.

Now config.getPositiveInt() is called with a default value
of 80 if the current value isn't already positive.
2013-04-30 22:37:02 -07:00
Kevin Sawicki
f417e898f6 Only call save on active item when it exists
Closes #529
2013-04-30 22:02:46 -07:00
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
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
probablycorey
ecad6bc2a8 Don't allow float or int Editor's to have NaN as a value 2013-04-26 15:36:57 -07:00