check whether index exists when using EnsureEditorTabActiveVisible
@@ -374,7 +374,7 @@ fn event(
if let Some(tab) =
data.main_split.editor_tabs.get(&self.widget_id)
{
- let active = &tab.children[tab.active];
+ if let Some(active) = tab.children.get(tab.active) {
match active.child_info(data) {
EditorTabChildInfo::Editor(info) => {
if info.content
@@ -389,15 +389,18 @@ fn event(
ctx.submit_command(Command::new(
LAPCE_UI_COMMAND,
LapceUICommand::ActiveFileChanged {
- path: if let BufferContent::File(path) =
- info.content
+ path: if let BufferContent::File(
+ path,
+ ) = info.content
{
Some(path)
} else {
None
},
},
- Target::Widget(data.file_explorer.widget_id),
+ Target::Widget(
+ data.file_explorer.widget_id,
+ ),
));
}
EditorTabChildInfo::Settings => {}
@@ -405,6 +408,7 @@ fn event(
return;
}
}
+ }
LapceUICommand::NextEditorTab => {
let editor_tab = data
.main_split
