mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
fix: error in the worker that merged more operations than needed.
This commit is contained in:
parent
bd6423856b
commit
4d65b2db7d
1 changed files with 9 additions and 3 deletions
|
@ -142,11 +142,15 @@ impl ControllerWorker<TextChange> for BufferWorker {
|
|||
// we give it to the controller so that he knows where it's at.
|
||||
let step_ver = oplog.version_union(&[lv.start], &last_ver);
|
||||
|
||||
branch.merge(&oplog, oplog.local_version_ref());
|
||||
// if you merge up until the oplog.local_version_ref()
|
||||
// it's as if you are merging the whole iterator.
|
||||
// Not just this change...
|
||||
let hash = if timer.step() {
|
||||
branch.merge(&oplog, &step_ver);
|
||||
let hash = xxhash_rust::xxh3::xxh3_64(branch.content().to_string().as_bytes());
|
||||
Some(i64::from_ne_bytes(hash.to_ne_bytes()))
|
||||
} else { None };
|
||||
|
||||
let tc = crate::api::change::TextChange {
|
||||
start: dtop.start() as u32,
|
||||
end: dtop.end() as u32,
|
||||
|
@ -174,7 +178,9 @@ impl ControllerWorker<TextChange> for BufferWorker {
|
|||
|
||||
struct Timer(u32, u32);
|
||||
impl Timer {
|
||||
fn new(period: u32) -> Self { Timer(0, period) }
|
||||
fn new(period: u32) -> Self {
|
||||
Timer(0, period)
|
||||
}
|
||||
fn step(&mut self) -> bool {
|
||||
self.0 += 1;
|
||||
if self.0 >= self.1 {
|
||||
|
|
Loading…
Reference in a new issue