Merge pull request #667 from zed-industries/fix-duplicate-nav-entries

Fix duplicate nav entries
This commit is contained in:
Max Brunsfeld 2022-03-23 11:49:00 -07:00 committed by GitHub
commit cbd4ef2ec5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 110 additions and 47 deletions

View file

@ -1393,8 +1393,6 @@ impl Editor {
}
}
self.push_to_nav_history(newest_selection.head(), Some(end.to_point(&buffer)), cx);
let selection = Selection {
id: post_inc(&mut self.next_selection_id),
start,
@ -5111,7 +5109,7 @@ impl Editor {
cx.notify();
}
fn transact(
pub fn transact(
&mut self,
cx: &mut ViewContext<Self>,
update: impl FnOnce(&mut Self, &mut ViewContext<Self>),
@ -6328,6 +6326,7 @@ mod tests {
editor.selected_display_ranges(cx),
&[DisplayPoint::new(3, 0)..DisplayPoint::new(3, 0)]
);
assert!(nav_history.borrow_mut().pop_backward().is_none());
// Move the cursor a small distance via the mouse.
// Nothing is added to the navigation history.
@ -6354,6 +6353,7 @@ mod tests {
editor.selected_display_ranges(cx),
&[DisplayPoint::new(5, 0)..DisplayPoint::new(5, 0)]
);
assert!(nav_history.borrow_mut().pop_backward().is_none());
editor
});