Skip to content

Commit 5f2976d

Browse files
committed
Remove automerge
1 parent c04ede7 commit 5f2976d

File tree

4 files changed

+11
-206
lines changed

4 files changed

+11
-206
lines changed

Cargo.lock

Lines changed: 1 addition & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aardvark-app/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7+
aardvark-doc = { path = "../aardvark-doc" }
78
aardvark-node = { path = "../aardvark-node" }
89
anyhow = "1.0.94"
9-
automerge = "0.5.12"
1010
gettext-rs = { version = "0.7", features = ["gettext-system"] }
1111
gtk = { version = "0.9", package = "gtk4", features = ["gnome_47"] }
1212
serde = { version = "1.0.215", features = ["derive"] }
1313
serde_json = "1.0.128"
14+
sourceview = { package = "sourceview5", version = "0.9" }
1415
tokio = { version = "1.42.0", features = ["full"] }
1516
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
16-
sourceview = { package = "sourceview5", version = "0.9" }
1717

1818
[dependencies.adw]
1919
package = "libadwaita"

aardvark-app/src/application.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@
2020

2121
use std::cell::{OnceCell, RefCell};
2222

23+
use aardvark_doc::{TextCrdt, TextCrdtEvent};
2324
use aardvark_node::network;
2425
use adw::prelude::*;
2526
use adw::subclass::prelude::*;
2627
use gettextrs::gettext;
2728
use gtk::{gio, glib};
2829
use tokio::sync::{mpsc, oneshot};
29-
use automerge::PatchAction;
3030

3131
use crate::config::VERSION;
32-
use crate::document::Document;
3332
use crate::glib::closure_local;
3433
use crate::{AardvarkTextBuffer, AardvarkWindow};
3534

@@ -46,8 +45,7 @@ mod imp {
4645
backend_shutdown: oneshot::Sender<()>,
4746
}
4847

49-
impl AardvarkApplication {
50-
}
48+
impl AardvarkApplication {}
5149

5250
#[glib::object_subclass]
5351
impl ObjectSubclass for AardvarkApplication {
@@ -182,24 +180,16 @@ impl AardvarkApplication {
182180

183181
// Apply remote changes to our local text CRDT
184182
if let Err(err) = document.load_incremental(&message) {
185-
eprintln!(
186-
"failed applying text change from remote peer to automerge document: {err}"
187-
);
188-
window.add_toast(adw::Toast::new(
189-
"The network provided bad data!"
190-
));
183+
eprintln!("failed applying text change from remote peer to automerge document: {err}");
184+
window.add_toast(adw::Toast::new("The network provided bad data!"));
191185
return;
192186
}
193187

194188
// Get latest changes and apply them to our local text buffer
195189
for patch in document.diff_incremental() {
196190
match &patch.action {
197191
PatchAction::SpliceText { index, value, .. } => {
198-
buffer.splice(
199-
*index as i32,
200-
0,
201-
value.make_string().as_str(),
202-
);
192+
buffer.splice(*index as i32, 0, value.make_string().as_str());
203193
}
204194
PatchAction::DeleteSeq { index, length } => {
205195
buffer.splice(*index as i32, *length as i32, "");
@@ -210,7 +200,9 @@ impl AardvarkApplication {
210200

211201
// Sanity check that the text buffer and CRDT are in the same state
212202
if buffer.full_text() != document.text() {
213-
window.add_toast(adw::Toast::new("The CRDT and the text view have different states!"));
203+
window.add_toast(adw::Toast::new(
204+
"The CRDT and the text view have different states!",
205+
));
214206
// if the state diverged, use the CRDT as the source of truth
215207
buffer.set_text(&document.text());
216208
}

aardvark-app/src/document.rs

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)