Commit Graph

64 Commits

Author SHA1 Message Date
Kevin Sawicki
1a04fa31d1 Clip range specified to Buffer.getTextInRange() 2013-01-29 15:35:14 -08:00
Kevin Sawicki & Nathan Sobo
98614592af Store line endings on a per-line basis in Buffer
The line ending for each line is recorded and reused
when lines are modified or inserted.

Closes #166
2013-01-27 16:01:22 -08:00
Kevin Sawicki
bc3646f180 💄 2013-01-23 16:24:40 -08:00
Kevin Sawicki
39fd4f7059 Remove extra subscribeToFile() call
This was causing an event listener to leak
on each call to save()

Closes #152
2013-01-22 14:44:34 -08:00
Nathan Sobo
0a08d03c68 Rename Buffer, TokenizedBuffer, and Selection events 2013-01-04 13:59:11 -07:00
Kevin Sawicki & Nathan Sobo
428900fdba Rename File 'remove' & 'move' events to passive voice
'remove' -> 'removed'
'move' -> 'moved'
2013-01-04 11:25:46 -07:00
Kevin Sawicki & Nathan Sobo
8e835acea4 Rename Buffer 'will-save' event to 'will-be-saved' 2013-01-04 11:25:45 -07:00
Nathan Sobo
5a409dde3c Rename File and Directory 'contents-change' to 'contents-changed' 2013-01-03 18:16:19 -07:00
Nathan Sobo
6d9402b5c9 Rename Anchor and Buffer events to passive-voice scheme 2013-01-02 13:48:10 -07:00
Nathan Sobo
bb710d0ae0 Buffer.save only writes to disk if the buffer is modified
This prevents autosave from writing unmodified buffers to disk, which
was causing the tree view to rebuild directory contents based on the
write event just when switching tabs.
2013-01-02 04:23:03 -07:00
Nathan Sobo
acc0503684 Merge remote-tracking branch 'origin/master' into config
Conflicts:
	src/app/keymap.coffee
	src/extensions/outline-view/src/keymap.coffee
	src/extensions/outline-view/src/tag-reader.coffee
	src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee
	src/packages/fuzzy-finder/src/fuzzy-finder.coffee
2012-12-18 20:32:05 -07:00
Corey Johnson
69485724cd Buffer emits a contents-modified event when it's contents differ from disk.
Including when the Buffer's file is removed via another process.
2012-11-29 12:05:05 -08:00
Corey Johnson
ae00e888fd un-f buffer spec 2012-11-29 10:36:56 -08:00
Corey Johnson
04c4c45190 💄 2012-11-29 08:53:39 -08:00
Corey Johnson & Nathan Sobo
e98b4f9a9b Use file contents instead of md5 to determine disk change 2012-11-28 17:16:44 -08:00
Corey Johnson & Nathan Sobo
ac84a8ab0a Destroy buffer to avoid leaking a path watch 2012-11-28 17:13:32 -07:00
Corey Johnson & Nathan Sobo
d6009df44e Buffers retain path when file is deleted and can be re-saved
Path watching resumes once the file is saved again. This commit allows files to be created for as-yet nonexistent paths. We won't call `$native.watchPath` until we have at least 1 subscription to the file in JS and the file exists on disk.

Also, we moved execution of the path watcher callbacks until after the callbacks data structure is updated in order to avoid confusing behavior in specs.
2012-11-28 16:55:10 -07:00
Corey Johnson & Nathan Sobo
eb0414f4e7 Emit a contents-conflicted` event instead of contents-change-on-disk 2012-11-28 15:21:12 -07:00
Corey Johnson & Nathan Sobo
d5d4751776 Don't set Buffer's file to null when the file is deleted (retain path) 2012-11-28 13:40:37 -07:00
Corey Johnson & Nathan Sobo
f9563f5e55 Fix PathWatcher failures
Now when a file is removed, we always remove its subscriptions and its kevent.
2012-11-19 13:16:14 -07:00
Corey Johnson
d9a3fbd910 BufferSpec doesn't double release buffers 2012-11-15 13:16:12 -08:00
Nathan Sobo
4a84c5f8f9 Add 'stopped-changing' event to buffer. Fires 300ms after last change.
This will be used by the status bar and other expensive code that needs to respond to the buffer changing, but that we don't want running on every single keystroke when the user is typing quickly.
2012-11-14 15:33:44 -07:00
Nathan Sobo
632bba5609 Kill dead code in spec 2012-11-14 15:13:50 -07:00
Corey Johnson
dbf8639375 Rename anchor.ignoreEqual to anchor.ignoreChangesStartingOnAnchor 2012-10-31 14:27:31 -07:00
Corey Johnson
84ea1017f4 Anchor.ignoreEqual works properly
The anchor ignores buffer changes when ignoreEqual is true and the oldRange.start == anchor.position
2012-10-31 14:27:21 -07:00
Corey Johnson
7793a04172 Filled in anchor specs 2012-10-31 14:27:07 -07:00
Kevin Sawicki
2531665570 Add Buffer.isEmpty()
To be used by Buffer.isModified() for when the
buffer has no backing file
2012-10-27 08:57:55 -07:00
Kevin Sawicki
acb5207d28 Treat file-less buffers as unmodified when empty 2012-10-26 13:56:21 -07:00
Corey Johnson & Nathan Sobo
adf00b60f3 Detect softTabs/hardTabs when an EditSession is created 2012-10-26 12:20:14 -06:00
Nathan Sobo
d310297fe7 Radically simplify the definition of "modified" for buffers
Now, we maintain md5 signatures for the on-disk and in-memory contents of the buffer. Whenever either contents change, we recompute the signature and store it on the buffer. We can tell if the buffer is modified by comparing these signatures. When the disk contents change, we compare the memory and disk signatures *before* recomputing the disk signature to determine whether to update the buffer or mark it as a conflict.
2012-10-25 13:08:38 -06:00
Corey Johnson
533ad84d03 Buffer.scanInRange can do a case-insensitive search 2012-09-25 16:30:44 -07:00
Corey Johnson & Nathan Sobo
12b06ddf0c Get spec suite running (lots of failures) 2012-08-27 17:36:36 -05:00
Nathan Sobo
c2c8724ad0 Initial commit 2012-08-10 13:32:19 -06:00
Nathan Sobo
1886b2a48e Merge branch 'master' of github.com:github/atom into global-find
Conflicts:
	spec/app/buffer-spec.coffee
	spec/extensions/command-panel-spec.coffee
	spec/extensions/tree-view-spec.coffee
	src/app/buffer.coffee
	src/extensions/command-panel/command-panel.coffee
	src/extensions/command-panel/keymap.coffee
2012-07-25 13:38:12 -06:00
Nathan Sobo
454557b502 Merge branch 'master' into global-find
Conflicts:
	spec/extensions/command-panel-spec.coffee
	src/app/buffer.coffee
	src/extensions/command-panel/command-panel.coffee
	src/extensions/command-panel/keymap.coffee
2012-07-24 17:59:49 -06:00
Corey Johnson
e491fe7bb7 Clean up after tests 2012-07-24 10:52:42 -07:00
Corey Johnson & Nathan Sobo
239fd2f9e6 buffer triggers a 'path-change' event when a file is moved or removed 2012-07-24 10:34:30 -07:00
Corey Johnson & Nathan Sobo
9658cf61ff Buffer.getPath() returns null when the buffer's file is deleted on disk 2012-07-23 16:35:24 -07:00
Nathan Sobo
c05fa7dc6f Merge branch 'master' into global-find
Conflicts:
	src/app/buffer.coffee
2012-07-20 19:01:38 -06:00
Corey Johnson & Nathan Sobo
b959d5aa37 Buffers are memoized on project by path 2012-07-18 12:56:09 -07:00
Corey Johnson & Nathan Sobo
c3fe9aa0b3 Implement refcounting scheme on Buffer 2012-07-17 14:24:33 -06:00
Corey Johnson
5914b6cc2a Add Buffer.reload() 2012-07-16 16:12:09 -07:00
Corey Johnson
611eb93219 Buffer stores a is modified on disk flag 2012-07-16 16:11:52 -07:00
Corey Johnson & Nathan Sobo
926067164d Buffer updates anchors when it changes instead of EditSession 2012-07-13 17:42:41 -06:00
David Graham & Nathan Sobo
6fbd019b1d Pull out a BufferChangeOperation, which Buffer.change sends to UndoManager 2012-07-05 19:07:12 -06:00
Corey Johnson & Nathan Sobo
b59bd4bc7b Saving a buffer does not trigger a "contents-change" event 2012-07-02 17:48:30 -07:00
Nathan Sobo
7387ad13f6 Merge branch 'master' of https://github.com/github/atom 2012-07-02 13:13:51 -06:00
Nathan Sobo
6b3180e144 Ensure path is present before building a Buffer with it in spec 2012-07-02 13:13:25 -06:00
Corey Johnson
10bfc56624 When a Buffer is created, the initial call to setText is not treated as an undoable change. 2012-07-02 11:39:22 -07:00
Corey Johnson
ae34611d2a Changes to buffer (via external process) do set buffer as modified. 2012-07-02 09:13:05 -07:00