Wiring tabs to update editor and handle closing of file view

This commit is contained in:
2025-06-02 00:10:56 -05:00
parent 04e3bbcc77
commit 0d1fdfa031
9 changed files with 86 additions and 22 deletions

View File

@@ -64,6 +64,34 @@ export class EditorsComponent {
).subscribe((uuid: string) => {
this.activeEditor = uuid;
});
this.editorsService.loadTabToEditor$().pipe(
takeUntil(this.unsubscribe)
).subscribe((path: string) => {
let file = this.files.get(path);
let editorComponent = this.getActiveEditorComponent();
let editor = editorComponent.editor;
editorComponent.activeFile = file;
editor.setSession(file.session);
});
this.editorsService.closeTabRequested$().pipe(
takeUntil(this.unsubscribe)
).subscribe((path: string) => {
let file = this.files.get(path);
let editors = [...this.editors.values()];
for (let i = 0; i < editors.length; i++) {
let editorComponent = editors[i].instance;
if (editorComponent.editor.session == file.session) {
editorComponent.newBuffer();
}
}
file.session.destroy();
this.files.delete(path);
});
}
loadMainSubscribers() {
@@ -205,6 +233,7 @@ export class EditorsComponent {
message.action = "create-tab";
message.message = file.fname;
message.uuid = file.hash;
message.data = file.path;
this.tabsService.setData(message);
}