Only clone editor_tab if used
@@ -62,12 +62,6 @@ fn mouse_down(
if mouse_event.button.is_left()
&& tab_rect.rect.contains(mouse_event.pos)
{
- let editor_tab = data
- .main_split
- .editor_tabs
- .get_mut(&self.widget_id)
- .unwrap();
- let editor_tab = Arc::make_mut(editor_tab);
if tab_rect.close_rect.contains(mouse_event.pos) {
self.cancel_pending_drag(data);
ctx.submit_command(Command::new(
@@ -77,6 +71,14 @@ fn mouse_down(
));
return;
}
+
+ let editor_tab = data
+ .main_split
+ .editor_tabs
+ .get_mut(&self.widget_id)
+ .unwrap();
+ let editor_tab = Arc::make_mut(editor_tab);
+
if editor_tab.active != i {
editor_tab.active = i;
ctx.submit_command(Command::new(
