Update imports
This commit is contained in:
parent
b53aa0c2b2
commit
c682520b88
3 changed files with 6 additions and 8 deletions
|
|
@ -3,10 +3,10 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::{CursorPosition, Operation, TextWithCursors};
|
use super::{CursorPosition, Operation, TextWithCursors};
|
||||||
use crate::{
|
use crate::{
|
||||||
diffs::{myers::diff, raw_operation::RawOperation},
|
|
||||||
operation_transformation::utils::{
|
operation_transformation::utils::{
|
||||||
cook_operations::cook_operations, elongate_operations::elongate_operations,
|
cook_operations::cook_operations, elongate_operations::elongate_operations,
|
||||||
},
|
},
|
||||||
|
raw_operation::RawOperation,
|
||||||
tokenizer::{Tokenizer, word_tokenizer::word_tokenizer},
|
tokenizer::{Tokenizer, word_tokenizer::word_tokenizer},
|
||||||
utils::{history::History, side::Side, string_builder::StringBuilder},
|
utils::{history::History, side::Side, string_builder::StringBuilder},
|
||||||
};
|
};
|
||||||
|
|
@ -65,7 +65,7 @@ where
|
||||||
let original_tokens = (tokenizer)(original);
|
let original_tokens = (tokenizer)(original);
|
||||||
let updated_tokens = (tokenizer)(&updated.text);
|
let updated_tokens = (tokenizer)(&updated.text);
|
||||||
|
|
||||||
let diff: Vec<RawOperation<T>> = diff(&original_tokens, &updated_tokens);
|
let diff: Vec<RawOperation<T>> = RawOperation::vec_from(&original_tokens, &updated_tokens);
|
||||||
|
|
||||||
Self::new(
|
Self::new(
|
||||||
original,
|
original,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
use crate::{
|
use crate::{operation_transformation::Operation, raw_operation::RawOperation, utils::side::Side};
|
||||||
diffs::raw_operation::RawOperation, operation_transformation::Operation, utils::side::Side,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Turn raw operations into ordered operations while keeping track of the
|
/// Turn raw operations into ordered operations while keeping track of the
|
||||||
/// original token's indexes.
|
/// original token's indexes.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use core::iter;
|
use core::iter;
|
||||||
|
|
||||||
use crate::diffs::raw_operation::RawOperation;
|
use crate::raw_operation::RawOperation;
|
||||||
|
|
||||||
/// Elongates the operations by merging adjacent insertions and deletions that
|
/// Elongates the operations by merging adjacent insertions and deletions that
|
||||||
/// can be joined. This makes the subsequent merging of operations more
|
/// can be joined. This makes the subsequent merging of operations more
|
||||||
|
|
@ -24,7 +24,7 @@ where
|
||||||
.flat_map(|next| match next {
|
.flat_map(|next| match next {
|
||||||
RawOperation::Insert(..) => match maybe_previous_insert.take() {
|
RawOperation::Insert(..) => match maybe_previous_insert.take() {
|
||||||
Some(prev) if prev.is_right_joinable() && next.is_left_joinable() => {
|
Some(prev) if prev.is_right_joinable() && next.is_left_joinable() => {
|
||||||
maybe_previous_insert = Some(prev.extend(next));
|
maybe_previous_insert = Some(prev.join(next));
|
||||||
Box::new(iter::empty()) as Box<dyn Iterator<Item = RawOperation<T>>>
|
Box::new(iter::empty()) as Box<dyn Iterator<Item = RawOperation<T>>>
|
||||||
}
|
}
|
||||||
prev => {
|
prev => {
|
||||||
|
|
@ -34,7 +34,7 @@ where
|
||||||
},
|
},
|
||||||
RawOperation::Delete(..) => match maybe_previous_delete.take() {
|
RawOperation::Delete(..) => match maybe_previous_delete.take() {
|
||||||
Some(prev) if prev.is_right_joinable() && next.is_left_joinable() => {
|
Some(prev) if prev.is_right_joinable() && next.is_left_joinable() => {
|
||||||
maybe_previous_delete = Some(prev.extend(next));
|
maybe_previous_delete = Some(prev.join(next));
|
||||||
Box::new(iter::empty()) as Box<dyn Iterator<Item = RawOperation<T>>>
|
Box::new(iter::empty()) as Box<dyn Iterator<Item = RawOperation<T>>>
|
||||||
}
|
}
|
||||||
prev => {
|
prev => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue