diff --git a/crates/clock/src/clock.rs b/crates/clock/src/clock.rs index bec98d9bfbc19b7e8ca72b97c5748d3efce4dcf6..6526ae1d55ead3e46b5fab293258492359fa2b24 100644 --- a/crates/clock/src/clock.rs +++ b/crates/clock/src/clock.rs @@ -260,7 +260,7 @@ impl fmt::Debug for Lamport { impl fmt::Debug for Global { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Global {{")?; - for timestamp in self.iter() { + for timestamp in self.iter().filter(|t| t.value > 0) { if timestamp.replica_id.0 > 0 { write!(f, ", ")?; } diff --git a/crates/repl/src/repl_editor.rs b/crates/repl/src/repl_editor.rs index a47d680e9bfe7a82cee25db360a59223e89df93e..84293fb27fdac7cfec7c3b7d38ecbc6527345e5b 100644 --- a/crates/repl/src/repl_editor.rs +++ b/crates/repl/src/repl_editor.rs @@ -477,11 +477,12 @@ fn language_supported(language: &Arc, cx: &mut App) -> bool { fn get_language(editor: WeakEntity, cx: &mut App) -> Option> { editor .update(cx, |editor, cx| { - let selection = editor - .selections - .newest::(&editor.display_snapshot(cx)); - let buffer = editor.buffer().read(cx).snapshot(cx); - buffer.language_at(selection.head()).cloned() + let display_snapshot = editor.display_snapshot(cx); + let selection = editor.selections.newest::(&display_snapshot); + display_snapshot + .buffer_snapshot() + .language_at(selection.head()) + .cloned() }) .ok() .flatten() diff --git a/crates/text/src/text.rs b/crates/text/src/text.rs index 851d4fecc402c06fcb4d5ed030796822a2c50558..d9a6b2bb26606c4192ef66351a5bd8f6bca667e7 100644 --- a/crates/text/src/text.rs +++ b/crates/text/src/text.rs @@ -2281,12 +2281,20 @@ impl BufferSnapshot { } else { insertion_cursor.prev(); } - let insertion = insertion_cursor.item().expect("invalid insertion"); + let Some(insertion) = insertion_cursor.item() else { + panic!( + "invalid insertion for buffer {}@{:?} with anchor {:?}", + self.remote_id(), + self.version, + anchor + ); + }; assert_eq!( insertion.timestamp, anchor.timestamp, - "invalid insertion for buffer {} with anchor {:?}", + "invalid insertion for buffer {}@{:?} and anchor {:?}", self.remote_id(), + self.version, anchor );