Skip to content

Commit

Permalink
Added new command for window navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimaoth committed Sep 13, 2024
1 parent c2fa1e2 commit 00d96ed
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 1 deletion.
Binary file modified config/wasm/harpoon.wasm
Binary file not shown.
Binary file modified config/wasm/keybindings_plugin.wasm
Binary file not shown.
Binary file modified config/wasm/vscode_config_plugin.wasm
Binary file not shown.
2 changes: 2 additions & 0 deletions scripting/editor_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ proc chooseFile*(preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
## Press <ESCAPE> to close the dialogue
editor_chooseFile_void_App_bool_float_float_float_impl(preview, scaleX,
scaleY, previewScale)
proc openLastEditor*() =
editor_openLastEditor_void_App_impl()
proc chooseOpen*(preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
previewScale: float = 0.6) =
editor_chooseOpen_void_App_bool_float_float_float_impl(preview, scaleX,
Expand Down
7 changes: 7 additions & 0 deletions scripting/editor_api_wasm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,13 @@ proc chooseFile*(preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
argsJsonString.cstring)


proc editor_openLastEditor_void_App_wasm(arg: cstring): cstring {.importc.}
proc openLastEditor*() =
var argsJson = newJArray()
let argsJsonString = $argsJson
let res {.used.} = editor_openLastEditor_void_App_wasm(argsJsonString.cstring)


proc editor_chooseOpen_void_App_bool_float_float_float_wasm(arg: cstring): cstring {.
importc.}
proc chooseOpen*(preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
Expand Down
2 changes: 2 additions & 0 deletions scripting/plugin_api_internal.nim
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,8 @@ proc editor_chooseFile_void_App_bool_float_float_float_impl*(
preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
previewScale: float = 0.5) =
discard
proc editor_openLastEditor_void_App_impl*() =
discard
proc editor_chooseOpen_void_App_bool_float_float_float_impl*(
preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
previewScale: float = 0.6) =
Expand Down
8 changes: 7 additions & 1 deletion src/app.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2745,14 +2745,20 @@ proc chooseFile*(self: App, preview: bool = true, scaleX: float = 0.8, scaleY: f

self.pushPopup popup

proc openLastEditor*(self: App) {.expose("editor").} =
if self.hiddenViews.len > 0:
let view = self.hiddenViews.pop()
self.addView(view, addToHistory=false, append=false)

proc chooseOpen*(self: App, preview: bool = true, scaleX: float = 0.8, scaleY: float = 0.8, previewScale: float = 0.6) {.expose("editor").} =
defer:
self.platform.requestRender()

proc getItems(): seq[FinderItem] =
var items = newSeq[FinderItem]()
let allViews = self.views & self.hiddenViews
for i, view in allViews:
for i in countdown(allViews.high, 0):
let view = allViews[i]
if not (view of EditorView):
continue

Expand Down

0 comments on commit 00d96ed

Please sign in to comment.