aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/transaction.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-05-25 04:02:21 +0000
committerBlaž Hrastnik2020-05-25 04:02:21 +0000
commit44ff4d3c1f5da05e57ce99ba9d67b80a334def83 (patch)
tree232b8eebab7f709eaf84b8649791a6c74448bfdb /helix-core/src/transaction.rs
parent240e5f4e3d27415b792776dd126d15302d53e83b (diff)
Implement a new core based on CodeMirror.
Diffstat (limited to 'helix-core/src/transaction.rs')
-rw-r--r--helix-core/src/transaction.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs
new file mode 100644
index 00000000..ecbe0c50
--- /dev/null
+++ b/helix-core/src/transaction.rs
@@ -0,0 +1,25 @@
+pub struct Change {
+ from: usize,
+ to: usize,
+ insert: Option<String>,
+}
+
+impl Change {
+ pub fn new(from: usize, to: usize, insert: Option<String>) {
+ // old_extent, new_extent, insert
+ }
+}
+
+pub struct Transaction {}
+
+// ChangeSpec = Change | ChangeSet | Vec<Change>
+// ChangeDesc as a ChangeSet without text: can't be applied, cheaper to store.
+// ChangeSet = ChangeDesc with Text
+pub struct ChangeSet {
+ // basically Vec<ChangeDesc> where ChangeDesc = (current len, replacement len?)
+ // (0, n>0) for insertion, (n>0, 0) for deletion, (>0, >0) for replacement
+ sections: Vec<(usize, isize)>,
+}
+//
+// trait Transaction
+// trait StrictTransaction