From ef5e5f9296d27d11ddfddf6d1c7daf93f9464ddb Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 21 Oct 2020 13:47:20 +0900 Subject: state.version tracking --- helix-view/src/commands.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'helix-view/src/commands.rs') diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs index 1d7737f0..e29d070e 100644 --- a/helix-view/src/commands.rs +++ b/helix-view/src/commands.rs @@ -391,6 +391,12 @@ fn append_changes_to_history(view: &mut View) { // annotations either add a new layer or compose into the previous one. let transaction = Transaction::from(changes).with_selection(view.state.selection().clone()); + // increment document version + // TODO: needs to happen on undo/redo too + view.state.version += 1; + + // TODO: trigger lsp/documentDidChange with changes + // HAXX: we need to reconstruct the state as it was before the changes.. let (doc, selection) = view.state.old_state.take().unwrap(); let mut old_state = State::new(doc); @@ -399,7 +405,6 @@ fn append_changes_to_history(view: &mut View) { // TODO: take transaction by value? view.history.commit_revision(&transaction, &old_state); - // TODO: need to start the state with these vals // HAXX view.state.old_state = Some((view.state.doc().clone(), view.state.selection.clone())); } -- cgit v1.2.3-70-g09d2