mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-28 21:32:39 +00:00
Avoid unnecessary clones when undoing/redoing selections
This commit is contained in:
parent
5ef6337b09
commit
f274a6ab4f
1 changed files with 6 additions and 6 deletions
|
@ -4421,9 +4421,9 @@ impl Editor {
|
||||||
self.end_selection(cx);
|
self.end_selection(cx);
|
||||||
self.selection_history.mode = SelectionHistoryMode::Undoing;
|
self.selection_history.mode = SelectionHistoryMode::Undoing;
|
||||||
if let Some(entry) = self.selection_history.undo_stack.pop_back() {
|
if let Some(entry) = self.selection_history.undo_stack.pop_back() {
|
||||||
self.set_selections(entry.selections.clone(), None, true, cx);
|
self.set_selections(entry.selections, None, true, cx);
|
||||||
self.select_next_state = entry.select_next_state.clone();
|
self.select_next_state = entry.select_next_state;
|
||||||
self.add_selections_state = entry.add_selections_state.clone();
|
self.add_selections_state = entry.add_selections_state;
|
||||||
self.request_autoscroll(Autoscroll::Newest, cx);
|
self.request_autoscroll(Autoscroll::Newest, cx);
|
||||||
}
|
}
|
||||||
self.selection_history.mode = SelectionHistoryMode::Normal;
|
self.selection_history.mode = SelectionHistoryMode::Normal;
|
||||||
|
@ -4433,9 +4433,9 @@ impl Editor {
|
||||||
self.end_selection(cx);
|
self.end_selection(cx);
|
||||||
self.selection_history.mode = SelectionHistoryMode::Redoing;
|
self.selection_history.mode = SelectionHistoryMode::Redoing;
|
||||||
if let Some(entry) = self.selection_history.redo_stack.pop_back() {
|
if let Some(entry) = self.selection_history.redo_stack.pop_back() {
|
||||||
self.set_selections(entry.selections.clone(), None, true, cx);
|
self.set_selections(entry.selections, None, true, cx);
|
||||||
self.select_next_state = entry.select_next_state.clone();
|
self.select_next_state = entry.select_next_state;
|
||||||
self.add_selections_state = entry.add_selections_state.clone();
|
self.add_selections_state = entry.add_selections_state;
|
||||||
self.request_autoscroll(Autoscroll::Newest, cx);
|
self.request_autoscroll(Autoscroll::Newest, cx);
|
||||||
}
|
}
|
||||||
self.selection_history.mode = SelectionHistoryMode::Normal;
|
self.selection_history.mode = SelectionHistoryMode::Normal;
|
||||||
|
|
Loading…
Reference in a new issue