Experiment with a more general way of pushing editor navigation entries

This commit is contained in:
Antonio Scandurra
2022-01-18 18:03:10 +01:00
parent 0cae3e0ac0
commit 16b82d59f1
4 changed files with 66 additions and 2 deletions
+11
View File
@@ -3297,6 +3297,17 @@ impl Editor {
}
self.pause_cursor_blinking(cx);
let prev_newest_selection = self.selections.iter().max_by_key(|s| s.id);
let curr_newest_selection = selections.iter().max_by_key(|s| s.id);
if let Some((prev_selection, curr_selection)) =
prev_newest_selection.zip(curr_newest_selection)
{
if prev_selection.head().to_offset(&buffer) != curr_selection.head().to_offset(&buffer)
{
self.push_to_navigation_history(cx);
}
}
self.set_selections(
Arc::from_iter(selections.into_iter().map(|selection| {
let end_bias = if selection.end > selection.start {
+2
View File
@@ -115,7 +115,9 @@ impl ItemView for Editor {
};
drop(buffer);
let navigation = self.navigation.take();
self.select_ranges([offset..offset], Some(Autoscroll::Fit), cx);
self.navigation = navigation;
}
}