Skip to content

Commit

Permalink
Add command lm:browser (or macro:browser)
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed May 15, 2024
1 parent 3af0780 commit 1ef0898
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 20 deletions.
4 changes: 3 additions & 1 deletion enc/enc_lua/macroapi_manual.en.tsi
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ lv=2
dt=Text
nm=Command line operations
ctime=3617997112
mtime=3637689351
mtime=3924957302
<article>
#_<markdown>
#_* `macro: load [path]`<br>
Expand All @@ -627,6 +627,8 @@ mtime=3637689351
#_ Unload macros (except those created with operation `MCTL_ADDMACRO`) and event handlers.
#_* `macro: about`<br>
#_ Show versions of the plugin and the libraries it is using.
#_* `macro: browser`<br>
#_ Run macro browser.
#_* `lua: [=] <code>`
#_* `moon: [=] <code>`<br>
#_ Execute the code `<code>` written correspondingly in Lua or MoonScript.<br>
Expand Down
4 changes: 3 additions & 1 deletion enc/enc_lua/macroapi_manual.pl.tsi
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ lv=2
dt=Text
nm=Operacje wiersza poleceń
ctime=3617997112
mtime=3637689351
mtime=3924957438
<article>
#_<markdown>
#_* `macro: load [ścieżka]`<br>
Expand All @@ -628,6 +628,8 @@ mtime=3637689351
#_ Wyładuj makra (poza tymi utworzonymi z operacją `MCTL_ADDMACRO`) i uchwyty zdarzeń z pamięci.
#_* `macro: about`<br>
#_ Pokazuje wersję wtyczki i bibliotek jakie są używane.
#_* `macro: browser`<br>
#_ Run macro browser.
#_* `lua: [=] <kod>`
#_* `moon: [=] <kod>`<br>
#_ Wykonuje kod `<kod>` napisany odpowiednio w Lua lub MoonScript.<br>
Expand Down
4 changes: 3 additions & 1 deletion enc/enc_lua/macroapi_manual.ru.tsi
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ lv=2
dt=Text
nm=Работа из командной строки
ctime=3617996372
mtime=3637689226
mtime=3924957404
<article>
#_<markdown>
#_* `macro: load [path]`<br>
Expand All @@ -628,6 +628,8 @@ mtime=3637689226
#_ Выгрузить макросы (кроме созданных операцией `MCTL_ADDMACRO`) и обработчики событий.
#_* `macro: about`<br>
#_ Показать версии плагина и используемых плагином библиотек.
#_* `macro: browser`<br>
#_ Открыть макро-браузер.
#_* `lua: [=] <code>`
#_* `moon: [=] <code>`<br>
#_ Исполнить код `<code>`, написанный соответственно на Lua или MoonScript.<br>
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/_globalinfo.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function export.GetGlobalInfo()
return {
Version = { 3, 0, 0, 831 },
Version = { 3, 0, 0, 832 },
MinFarVersion = { 3, 0, 0, 6327 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
Expand Down
6 changes: 6 additions & 0 deletions plugins/luamacro/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
shmuel 2024-05-15 17:51:04+03:00 - build 832

1. Add command lm:browser (or macro:browser).

2. Shift+F4 in macro browser does the same as Alt+F4.

shmuel 2024-05-06 11:34:46+03:00 - build 831

1. mf.eval(S,2): invalid area in 'S' is treated as a part of key
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/lm_bel.lng
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"F1 адлюстраваць гэтую даведку"
"F3 звестка аб макрасе ці апрасоўшчыка падзеі"
"F4 адчыніць файл для змены"
"Alt+F4 адчыніць файл для мадальный змены"
"Shift+F4 адчыніць файл для мадальный змены"
"Ctrl+PgUp перайсці да файла на актыўная панэлі"
"Ctrl+F1 парадкаваць макрасы па вобласці"
"Ctrl+F2 парадкаваць макрасы па ключу"
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/lm_eng.lng
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"F1 show this help window"
"F3 show info about macro/event handler"
"F4 open file in editor"
"Alt+F4 open file in modal editor"
"Shift+F4 open file in modal editor"
"Ctrl+PgUp locate file in active panel"
"Ctrl+F1 sort macros by area"
"Ctrl+F2 sort macros by key"
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/lm_ita.lng
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"F1 Mostra Questa Finestra Di Aiuto"
"F3 Mostra Info Riguardo La Macro"
"F4 Apri File Per La Modifica"
"Alt+F4 Apre File In Popup Editor"
"Shift+F4 Apre File In Popup Editor"
"Ctrl+PgUp Trova Il File Nel Pannello Attivo"
"Ctrl+F1 Ordina Macro Per Area"
"Ctrl+F2 Ordina Macro Per Tasti"
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/lm_pol.lng
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"F1 pokazuje to okno pomocy"
"F3 pokazuje info o makrze/uchwycie zdarzenia"
"F4 otwiera plik w edytorze"
"Alt+F4 otwiera plik w edytorze modalnym"
"Shift+F4 otwiera plik w edytorze modalnym"
"Ctrl+PgUp znajduje plik w aktywnym panelu"
"Ctrl+F1 sortuje makra wg lokalizacji"
"Ctrl+F2 sortuje makra wg klucza"
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/lm_rus.lng
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"F1 показать эту справку"
"F3 информация о макросе или обработчике события"
"F4 открыть файл в редакторе"
"Alt+F4 открыть файл в модальном редакторе"
"Shift+F4 открыть файл в модальном редакторе"
"Ctrl+PgUp перейти к файлу на активной панели"
"Ctrl+F1 сортировать макросы по области"
"Ctrl+F2 сортировать макросы по ключу"
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/lm_sky.lng
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"F1 zobraziť toto okno Pomocníka"
"F3 show info about macro/event"
"F4 otvoriť súbor v editore"
"Alt+F4 otvoriť súbor v modálnom editore"
"Shift+F4 otvoriť súbor v modálnom editore"
"Ctrl+PgUp prejsť na súbor v aktívnom paneli"
"Ctrl+F1 triediť makrá podľa oblasti"
"Ctrl+F2 triediť makrá podľa klávesu"
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/lm_spa.lng
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"F1 mostrar esta ventana de ayuda"
"F3 mostrar info acerca de macro/evento"
"F4 abrir archivo en editor"
"Alt+F4 abrir archivo en modo editor"
"Shift+F4 abrir archivo en modo editor"
"Ctrl+PgUp localizar archivo en panel activo"
"Ctrl+F1 ordenar macros por área"
"Ctrl+F2 ordenar macros por tecla"
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luafar/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 831
#define PLUGIN_BUILD 832
19 changes: 14 additions & 5 deletions plugins/luamacro/luamacro.lua
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,25 @@ local function Open_CommandLine (strCmdLine)
if not prefix then return end -- this can occur with Plugin.Command()
prefix = prefix:lower()
if prefix == "lm" or prefix == "macro" then
if text=="" then ShowCmdLineHelp(); return; end
if text == "" then
ShowCmdLineHelp(); return;
end
local cmd = text:match("%S*"):lower()
if cmd == "load" then
local paths = text:match("%S.*",5)
paths = paths and paths:gsub([[^"(.+)"$]], "%1")
far.MacroLoadAll(paths)
elseif cmd == "save" then utils.WriteMacros()
elseif cmd == "unload" then utils.UnloadMacros()
elseif cmd == "about" then About()
elseif cmd ~= "" then ErrMsg(Msg.CL_UnsupportedCommand .. cmd) end
elseif cmd == "save" then
utils.WriteMacros()
elseif cmd == "unload" then
utils.UnloadMacros()
elseif cmd == "about" then
About()
elseif cmd == "browser" then
macrobrowser()
elseif cmd ~= "" then
ErrMsg(Msg.CL_UnsupportedCommand .. cmd)
end
elseif prefix == "lua" or prefix == "moon" or prefix == "luas" or prefix == "moons" then
if text=="" then ShowCmdLineHelp(); return; end
local show = false
Expand Down
6 changes: 3 additions & 3 deletions plugins/luamacro/mbrowser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ local function MenuLoop()

local bkeys = {
{BreakKey="F1"}, {BreakKey="F3"}, {BreakKey="F4"}, {BreakKey="A+F4"}, {BreakKey="C+H"},
{BreakKey="C+PRIOR"}, {BreakKey="C+R"},
{BreakKey="C+PRIOR"}, {BreakKey="C+R"}, {BreakKey="S+F4"}
}
for k in pairs(CmpFuncs) do bkeys[#bkeys+1] = {BreakKey=k} end

Expand Down Expand Up @@ -550,15 +550,15 @@ local function MenuLoop()
ShowOnlyActive = not ShowOnlyActive
props.SelectIndex = nil
----------------------------------------------------------------------------
elseif (BrKey=="F4" or BrKey=="A+F4") and items[pos] then -- edit
elseif (BrKey=="F4" or BrKey=="A+F4" or BrKey=="S+F4") and items[pos] then -- edit
local m = items[pos].macro
if m.FileName then
local isMoonScript = string.find(m.FileName, "[nN]", -1)
local startline = m.action and debug.getinfo(m.action,"S").linedefined
if isMoonScript then
startline = utils.GetMoonscriptLineNumber(m.FileName,startline) or startline
end
if BrKey=="A+F4" then -- modal editor
if BrKey=="A+F4" or BrKey=="S+F4" then -- modal editor
editor.Editor(m.FileName,nil,nil,nil,nil,nil,nil,startline,nil,65001)
elseif BrKey=="F4" then -- non-modal editor
local a = far.MacroGetArea()
Expand Down

0 comments on commit 1ef0898

Please sign in to comment.