Include saved mtime and fingerprint when serializing buffers

This still doesn't include:

- An assertion in the randomized test to ensure buffers are not spuriously
marked as modified
- Sending an update when synchronizing buffers after a reconnection
This commit is contained in:
Antonio Scandurra 2023-01-16 16:22:47 +01:00
parent 625151806a
commit 467e5691b9
2 changed files with 9 additions and 0 deletions

View file

@ -385,6 +385,11 @@ impl Buffer {
rpc::proto::LineEnding::from_i32(message.line_ending)
.ok_or_else(|| anyhow!("missing line_ending"))?,
));
this.saved_version_fingerprint = message.saved_version_fingerprint;
this.saved_mtime = message
.saved_mtime
.ok_or_else(|| anyhow!("invalid saved_mtime"))?
.into();
Ok(this)
}
@ -395,6 +400,8 @@ impl Buffer {
base_text: self.base_text().to_string(),
diff_base: self.diff_base.as_ref().map(|h| h.to_string()),
line_ending: proto::serialize_line_ending(self.line_ending()) as i32,
saved_version_fingerprint: self.saved_version_fingerprint.clone(),
saved_mtime: Some(self.saved_mtime.into()),
}
}

View file

@ -975,6 +975,8 @@ message BufferState {
string base_text = 3;
optional string diff_base = 4;
LineEnding line_ending = 5;
string saved_version_fingerprint = 6;
Timestamp saved_mtime = 7;
}
message BufferChunk {