From 50a46682bb693303be5a4b1b518f75c406171bf8 Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Fri, 23 May 2025 16:18:44 +0100 Subject: [PATCH] feat: open on the editor --- app.go | 5 +++++ frontend/src/App.svelte | 8 ++++++++ frontend/wailsjs/go/main/App.d.ts | 2 ++ frontend/wailsjs/go/main/App.js | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/app.go b/app.go index a9ea596..364cbf9 100644 --- a/app.go +++ b/app.go @@ -190,3 +190,8 @@ func (a *App) EnterDir(value string) { fmt.Printf("ghostty --working-directory=%s", value) runtime.Quit(a.ctx) } + +func (a *App) EnterEditor(value string) { + fmt.Printf("czed %s", value) + runtime.Quit(a.ctx) +} diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index a9a2e5e..9790cb2 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -7,6 +7,7 @@ Search, Enter, EnterDir, + EnterEditor, SearchRemeberDir, } from "../wailsjs/go/main/App.js"; @@ -79,6 +80,13 @@ if (search[selectedI - remeberSearch.length]) { Enter(search[selectedI - remeberSearch.length]); } + } else if (e.key === "e" && e.ctrlKey) { + if (selectedI < remeberSearch.length) { + e.preventDefault(); + e.stopPropagation(); + EnterEditor(remeberSearch[selectedI]); + return; + } } }} /> diff --git a/frontend/wailsjs/go/main/App.d.ts b/frontend/wailsjs/go/main/App.d.ts index 9df5648..ad57bfb 100755 --- a/frontend/wailsjs/go/main/App.d.ts +++ b/frontend/wailsjs/go/main/App.d.ts @@ -7,6 +7,8 @@ export function Enter(arg1:string):Promise; export function EnterDir(arg1:string):Promise; +export function EnterEditor(arg1:string):Promise; + export function Search(arg1:string):Promise>; export function SearchDict(arg1:string):Promise; diff --git a/frontend/wailsjs/go/main/App.js b/frontend/wailsjs/go/main/App.js index 0b3ca82..00a27fe 100755 --- a/frontend/wailsjs/go/main/App.js +++ b/frontend/wailsjs/go/main/App.js @@ -14,6 +14,10 @@ export function EnterDir(arg1) { return window['go']['main']['App']['EnterDir'](arg1); } +export function EnterEditor(arg1) { + return window['go']['main']['App']['EnterEditor'](arg1); +} + export function Search(arg1) { return window['go']['main']['App']['Search'](arg1); }