1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use Range;
/// An individual textual modification within a document transaction.
/// A group of edits that represents a single undoable operation.
///
/// A transaction may contain multiple edits that are undone and redone
/// together. The cursor positions record the state before and after the
/// transaction.
///
/// # Fields
///
/// * `edits` - The edits that make up this transaction.
/// * `previous_cursor` - The cursor position before the transaction.
/// * `resulting_cursor` - The cursor position after the transaction.
/// Tracks the undo and redo history of a document.
///
/// Transactions are stored in the undo stack when they are applied.
/// When a transaction is undone, it is moved to the redo stack. When
/// it is redone, it is moved back to the undo stack.
///
/// The most recent transaction is stored at the end of each stack.
///
/// Adding a new edit after undoing previous edits should clear the
/// redo stack, as the previous redo history is no longer applicable.