From 8cef2527d6ab302607e75004648f539893974740 Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Sat, 24 May 2025 15:38:54 +0100 Subject: [PATCH] chore: rename EnterEditor to OpenEditor feat: added optin to go back to the end of the saved dirs with a single key --- app.go | 2 +- frontend/src/App.svelte | 8 ++++++-- frontend/wailsjs/go/main/App.d.ts | 2 +- frontend/wailsjs/go/main/App.js | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app.go b/app.go index 364cbf9..ec0b1a3 100644 --- a/app.go +++ b/app.go @@ -191,7 +191,7 @@ func (a *App) EnterDir(value string) { runtime.Quit(a.ctx) } -func (a *App) EnterEditor(value string) { +func (a *App) OpenEditor(value string) { fmt.Printf("czed %s", value) runtime.Quit(a.ctx) } diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 9790cb2..c29a81a 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -7,7 +7,7 @@ Search, Enter, EnterDir, - EnterEditor, + OpenEditor, SearchRemeberDir, } from "../wailsjs/go/main/App.js"; @@ -71,6 +71,10 @@ (search ?? []).length + (remeberSearch ?? []).length, ); } else if (e.key === "ArrowUp") { + if (selectedI === 0 && (remeberSearch ?? []).length > 0) { + selectedI = remeberSearch.length - 1; + return; + } selectedI = Math.max(selectedI - 1, 0); } else if (e.key === "Enter") { if (selectedI < remeberSearch.length) { @@ -84,7 +88,7 @@ if (selectedI < remeberSearch.length) { e.preventDefault(); e.stopPropagation(); - EnterEditor(remeberSearch[selectedI]); + OpenEditor(remeberSearch[selectedI]); return; } } diff --git a/frontend/wailsjs/go/main/App.d.ts b/frontend/wailsjs/go/main/App.d.ts index ad57bfb..767d675 100755 --- a/frontend/wailsjs/go/main/App.d.ts +++ b/frontend/wailsjs/go/main/App.d.ts @@ -7,7 +7,7 @@ export function Enter(arg1:string):Promise; export function EnterDir(arg1:string):Promise; -export function EnterEditor(arg1:string):Promise; +export function OpenEditor(arg1:string):Promise; export function Search(arg1:string):Promise>; diff --git a/frontend/wailsjs/go/main/App.js b/frontend/wailsjs/go/main/App.js index 00a27fe..781c44d 100755 --- a/frontend/wailsjs/go/main/App.js +++ b/frontend/wailsjs/go/main/App.js @@ -14,8 +14,8 @@ export function EnterDir(arg1) { return window['go']['main']['App']['EnterDir'](arg1); } -export function EnterEditor(arg1) { - return window['go']['main']['App']['EnterEditor'](arg1); +export function OpenEditor(arg1) { + return window['go']['main']['App']['OpenEditor'](arg1); } export function Search(arg1) {