mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 03:59:55 +00:00
Revert "Ensure there's always at least one selection in the editor"
This reverts commit b1a44b5816
.
This commit is contained in:
parent
612a33147a
commit
ad9a0e2d4f
1 changed files with 9 additions and 5 deletions
|
@ -1242,7 +1242,6 @@ impl Editor {
|
||||||
goal: SelectionGoal::None,
|
goal: SelectionGoal::None,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.pending_selection = Some(PendingSelection { selection, mode });
|
|
||||||
if !add {
|
if !add {
|
||||||
self.update_selections::<usize>(Vec::new(), None, cx);
|
self.update_selections::<usize>(Vec::new(), None, cx);
|
||||||
} else if click_count > 1 {
|
} else if click_count > 1 {
|
||||||
|
@ -1252,6 +1251,8 @@ impl Editor {
|
||||||
self.update_selections::<usize>(selections, None, cx)
|
self.update_selections::<usize>(selections, None, cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.pending_selection = Some(PendingSelection { selection, mode });
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4436,16 +4437,19 @@ impl Editor {
|
||||||
.display_map
|
.display_map
|
||||||
.update(cx, |display_map, cx| display_map.snapshot(cx));
|
.update(cx, |display_map, cx| display_map.snapshot(cx));
|
||||||
let buffer = &display_map.buffer_snapshot;
|
let buffer = &display_map.buffer_snapshot;
|
||||||
if !self.selections.is_empty() {
|
self.pending_selection = None;
|
||||||
self.pending_selection = None;
|
|
||||||
}
|
|
||||||
self.add_selections_state = None;
|
self.add_selections_state = None;
|
||||||
self.select_next_state = None;
|
self.select_next_state = None;
|
||||||
self.select_larger_syntax_node_stack.clear();
|
self.select_larger_syntax_node_stack.clear();
|
||||||
self.autoclose_stack.invalidate(&self.selections, &buffer);
|
self.autoclose_stack.invalidate(&self.selections, &buffer);
|
||||||
self.snippet_stack.invalidate(&self.selections, &buffer);
|
self.snippet_stack.invalidate(&self.selections, &buffer);
|
||||||
|
|
||||||
let new_cursor_position = self.newest_anchor_selection().head();
|
let new_cursor_position = self
|
||||||
|
.selections
|
||||||
|
.iter()
|
||||||
|
.max_by_key(|s| s.id)
|
||||||
|
.map(|s| s.head())
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
self.push_to_nav_history(
|
self.push_to_nav_history(
|
||||||
old_cursor_position.clone(),
|
old_cursor_position.clone(),
|
||||||
|
|
Loading…
Reference in a new issue