From bf3a5d0a0d9800fbce45629e6217cd9cf627502e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 9 Apr 2021 11:25:28 +0200 Subject: [PATCH] Move UndoMap down --- zed/src/editor/buffer/mod.rs | 68 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/zed/src/editor/buffer/mod.rs b/zed/src/editor/buffer/mod.rs index 77bae2f5fc..951eb6fd10 100644 --- a/zed/src/editor/buffer/mod.rs +++ b/zed/src/editor/buffer/mod.rs @@ -56,6 +56,40 @@ type HashMap = std::collections::HashMap; #[cfg(not(test))] type HashSet = std::collections::HashSet; +pub struct Buffer { + file: Option, + fragments: SumTree, + insertion_splits: HashMap>, + edit_ops: HashMap, + pub version: time::Global, + saved_version: time::Global, + last_edit: time::Local, + undo_map: UndoMap, + selections: HashMap>, + pub selections_last_update: SelectionsVersion, + deferred_ops: OperationQueue, + deferred_replicas: HashSet, + replica_id: ReplicaId, + local_clock: time::Local, + lamport_clock: time::Lamport, +} + +pub struct Snapshot { + fragments: SumTree, +} + +#[derive(Clone)] +pub struct History { + pub base_text: String, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct Selection { + pub start: Anchor, + pub end: Anchor, + pub reversed: bool, +} + #[derive(Clone, Default, Debug)] struct UndoMap(HashMap>); @@ -92,40 +126,6 @@ impl UndoMap { } } -pub struct Buffer { - file: Option, - fragments: SumTree, - insertion_splits: HashMap>, - edit_ops: HashMap, - pub version: time::Global, - saved_version: time::Global, - last_edit: time::Local, - undo_map: UndoMap, - selections: HashMap>, - pub selections_last_update: SelectionsVersion, - deferred_ops: OperationQueue, - deferred_replicas: HashSet, - replica_id: ReplicaId, - local_clock: time::Local, - lamport_clock: time::Lamport, -} - -pub struct Snapshot { - fragments: SumTree, -} - -#[derive(Clone)] -pub struct History { - pub base_text: String, -} - -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct Selection { - pub start: Anchor, - pub end: Anchor, - pub reversed: bool, -} - #[derive(Clone)] pub struct CharIter<'a> { fragments_cursor: Cursor<'a, Fragment, usize, usize>,