From 5aa6c7ca10b38230518196db92edf77a6f71403f Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Thu, 3 Jul 2025 10:22:53 -0500 Subject: [PATCH] Fixing new file keybinding logic; fixing file selection when only oe remains --- src/app/common/configs/keybindings.config.ts | 3 ++- src/app/common/services/editor/editors.service.ts | 7 +++++++ src/app/editor/code-view/view.base.ts | 7 ++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/app/common/configs/keybindings.config.ts b/src/app/common/configs/keybindings.config.ts index e56d34e..2218570 100644 --- a/src/app/common/configs/keybindings.config.ts +++ b/src/app/common/configs/keybindings.config.ts @@ -39,7 +39,8 @@ export const Keybindings: Array<{}> = [ }, { name: "newFile", bindKey: {win: "ctrl-t", mac: "ctrl-t"}, - readOnly: true + service: "editorsService", + readOnly: false }, { name: "openFiles", bindKey: {win: "ctrl-o", mac: "ctrl-o"}, diff --git a/src/app/common/services/editor/editors.service.ts b/src/app/common/services/editor/editors.service.ts index f4a1b94..0af256b 100644 --- a/src/app/common/services/editor/editors.service.ts +++ b/src/app/common/services/editor/editors.service.ts @@ -71,6 +71,13 @@ export class EditorsService { this.miniMapView.cloneSession(file); } + public newFile() { + let editorComponent = this.getActiveEditorComponent(); + + editorComponent.newFile(); + this.miniMapView.newFile(); + } + public getSession() { let editorComponent = this.get(this.activeEditor); let editor = editorComponent.editor; diff --git a/src/app/editor/code-view/view.base.ts b/src/app/editor/code-view/view.base.ts index 6f85316..7a4265f 100644 --- a/src/app/editor/code-view/view.base.ts +++ b/src/app/editor/code-view/view.base.ts @@ -132,7 +132,7 @@ export class CodeViewBase { return result; }, onAccept: (data) => { - let fpath = data.value; + let fpath = (data.value) ? data.value : data.item; let path = ""; for (let i = 0; i < stubPaths.length; i++) { @@ -143,8 +143,9 @@ export class CodeViewBase { if (!path) return; - this.activeFile = this.filesService.get(path); - this.editor.setSession(this.activeFile.session); + this.editorsService.setSession( + this.filesService.get(path) + ); } });