Commit Graph

20 Commits

Author SHA1 Message Date
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
Kevin Sawicki & Nathan Sobo
1d1ba5f6d1 Use node's require instead of internal require 2013-03-12 10:38:05 -07:00
Nathan Sobo
3f50dbe1f8 💄 2013-01-29 16:00:45 -07:00
Kevin Sawicki & Nathan Sobo
725c4cf132 Rethrow exceptions during undo, redo, and pushOperation 2013-01-04 13:20:58 -07:00
Kevin Sawicki & Nathan Sobo
82d4550ff3 Throw exception when aborting/committing without a transaction 2013-01-04 13:02:56 -07:00
Kevin Sawicki & Nathan Sobo
da095cdfe9 Leave the undo stack intact when aborting empty transactions 2013-01-04 13:02:33 -07:00
Kevin Sawicki & Nathan Sobo
e64047854d Add UndoManager.abort and .commit
When `UndoManager.transact` is called with no function, you later need
to `abort` or `commit` the transaction manually. This allows
transactions to last longer than the dynamic scope of the single
function passed to `transact`.
2013-01-04 11:52:39 -07:00
Nathan Sobo
f7b1f0521a Emit row-oriented events from DisplayBuffer 2012-11-16 07:36:36 -07:00
Corey Johnson
bb9c2e1bcb Handle exceptions thrown during do/undo/redo 2012-11-12 15:59:44 -08: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
42eefb49a9 Add UndoManager.prototype.transact
The `transact` method takes a function and batches all operations within that function as a single transaction to be undone and redone. The edit session now uses generic operations to restore selection state around transactions. The `undo` and `do` methods on operations are now optional. In addition, the undo manager now supports an optional `redo` method on an operation for code that should *only* be run on redo, and not when the operation is initially pushed. This is used by edit session to restore selection state after redo.
2012-07-05 20:04:16 -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
801a91ec9b Specs cleanup buffers 2012-06-29 15:38:12 -07:00
Corey Johnson & Nathan Sobo
7462222387 Allow calls to startBatch/endBatch to be nested 2012-04-19 11:19:24 -06:00
Corey Johnson & Nathan Sobo
fa50e9705e No longer push empty batches onto undo stack 2012-04-10 10:25:29 -07:00
Nathan Sobo
cbeb351de4 Restore selections after undo
This only restores changes made via the CompositeSelection… this makes sense because this is the only way to make changes interactively. Any other changes are made via the api or a command line and should not modify selections when they are undone. Still need to test restoration after redo.
2012-04-04 18:04:32 -06:00
Nathan Sobo
5def158584 UndoManager's batch methods take optional arrays of ranges for restoring the selection 2012-04-04 17:07:52 -06:00
Corey Johnson & Nathan Sobo
48b4008cab Changes made with multiple cursors are undone/redone in parallel 2012-04-04 14:21:03 -06:00
Corey Johnson
1efb712fd3 Rename App.coffee to Atom.coffee. This also required moving src/atom,spec/atom to src/app,spec/app 2012-04-03 10:33:24 -07:00