From 00d96edd76f81ae4c65c9274a59009e7853c01ef Mon Sep 17 00:00:00 2001 From: Nimaoth Date: Fri, 13 Sep 2024 14:17:32 +0200 Subject: [PATCH] Added new command for window navigation --- config/wasm/harpoon.wasm | Bin 683452 -> 683452 bytes config/wasm/keybindings_plugin.wasm | Bin 1941584 -> 1941584 bytes config/wasm/vscode_config_plugin.wasm | Bin 516793 -> 516793 bytes scripting/editor_api.nim | 2 ++ scripting/editor_api_wasm.nim | 7 +++++++ scripting/plugin_api_internal.nim | 2 ++ src/app.nim | 8 +++++++- 7 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/wasm/harpoon.wasm b/config/wasm/harpoon.wasm index db92e1d187a1070bd5a640f13e46a3c77b4766bd..d1be2fa8724fb87768d836765ad76a3232359e79 100644 GIT binary patch delta 652 zcmYjNJ!n%=6wW#K^gV52nz$H{($@}}L~YZ&zL=<>R~!^|kUDosYcPW^F@-J}Vu>ww zPzTFVv4c7&NC$uL76~|uD59vXaT9TH@~2IqQM@ma>Tuwl@4oZ>)#|ZYJyxkg6|3SA zozKF3p30H~kGYnm?!E_s6hM0JEzZH^RXPo;U!PxC;{*JZcbZx)8&z9 zbhnQUTx_ z?(lBNSGm9MlWyHY R9u}sa4SF`JVbOUy{|6C|u73ak delta 652 zcmYjNJ!n%=6wW#K^gV6THgz!|rLP?{iQ4ARyhH`P;-IL5)Y&Di!3@5{6uM+6H8vtB zai|BY&Wfd|RJaZSH$^I1|3JwoB3QL9rPWmNzC^0Sf%l#JzQ0qehidiEcp1uA77yrr z2JY}=hIYYSu4SmFf5w-@poNylKQ1hg_nHu7AZMX}74_ymH!{=ljRHL9>IeQk12CQPv3(IOSz=V+00oO39?^+IP7BbtptJk%1n)ZC!7)&(wi za-l>4t~=BPRki5QHQ4sW>o)fs@Yo{d|BZcMdF0pD&aDrww?}^CnS!prq~;5h2l&i; zi~4v=e72|~Eb`4F#o#+H6e%u$bR=&um^nlEJFHn{)eK^{aS9ml0K_$Ddf-A z&#n`>PC_<1)WK0YVPe(G-45-8X!q6k@y?%oHXPd>qVMB9*qe0cH{tX^x}08zOuL%?}v2 SD?`H6vq8^BH6+?k=l%esgRaW} diff --git a/config/wasm/keybindings_plugin.wasm b/config/wasm/keybindings_plugin.wasm index 99b28097378ba16dd3878dcd377b5849d7ee5734..b5775dc800bef0a28d1631000899bb46dd9aea15 100644 GIT binary patch delta 2976 zcmZuyeQ;FO704;QcgvC zxoslPkO`S)4dpqFKLb@DN(D=&}1?e{>c z{fEhWD`E^5;Z^)G23P+Yl63W6urRg{V;4gvYs9?8RLiB85;`djP&VV?wdHH787#K5jvwoI9332*n@D}yw9EAenmWb7~@*KDDTo$ zY{h5oSCW}6Li<{-84b(~RU)+i;Ml{&;v3!i2z+2+yQMhwQk*?u;^Z|*8EpIxX3b$> zW7KC*WZedonQQyZx1pA7lplw+WRuyF`umSjL26wbaYO3{NW{@XQt}=Aksc}a#_~jk z4JPE8FH~V8<~|M%_OAY`$6*`e&2iXW3iEku9F8@@jA@%8IfA&f5WFrP?})?XdPqs# zD|xn2&M*->O&BiXF}?d2a39OBp=Q6u#zOLO>U5NAVfS{6TygNk6d*OUO-D!=2e;0# z&Q3P`p*9+yS_@z44?YPQoSnhS72uqEmTV-C%2e)Pt{mpHMc5S0S!6ZYE7}Nlub?*i z0(lWN)u%YWh|rg~oKVU+b0?7dP@5~-MVUx*71_WzPDT4l-)rom?@vAjUUnH{R}#F4 z*()J~eTypy*{@J5=G#I^zB8es4Mc>pT*dt>N#_6RBP-z`V<)h76}5RUcCDhb`Uo$s zB1Qu^x0sHs&pe}0vVaK{BVNPB$~&f0B4W?ZwNL-)uP2Tz}LLXJ7s zTg(&c)1P<_)-hI(ZRK?T8gQ(fG}=eI!VJ67gyB}#WR+I8=Jx=MUBQy|B=>i?Z#`}P znwmfC>R&Y>*Zxid2mSdPURzJ1e6QR80QHQG%DexWy!#)A-~E5fyZ*O4~@I1VE`}zOlLKmjE(3ge_iO6~8abHC8q8_ZPqA?nfm7I~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=CophY899D{dSu42Id z+!IC4+vyJn!BpGnPf@6%7vPS{H5q%PpBe_>p8Dz-gcq8rh40vjx diff --git a/scripting/editor_api.nim b/scripting/editor_api.nim index 23f1ff48..487c86a9 100644 --- a/scripting/editor_api.nim +++ b/scripting/editor_api.nim @@ -180,6 +180,8 @@ proc chooseFile*(preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8; ## Press 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, diff --git a/scripting/editor_api_wasm.nim b/scripting/editor_api_wasm.nim index f97a0370..7bf46bde 100644 --- a/scripting/editor_api_wasm.nim +++ b/scripting/editor_api_wasm.nim @@ -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; diff --git a/scripting/plugin_api_internal.nim b/scripting/plugin_api_internal.nim index c05c0a39..d7611f20 100644 --- a/scripting/plugin_api_internal.nim +++ b/scripting/plugin_api_internal.nim @@ -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) = diff --git a/src/app.nim b/src/app.nim index a072bd15..693cd616 100644 --- a/src/app.nim +++ b/src/app.nim @@ -2745,6 +2745,11 @@ 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() @@ -2752,7 +2757,8 @@ proc chooseOpen*(self: App, preview: bool = true, scaleX: float = 0.8, scaleY: f 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