From 0b778587298bfba6c1f6e9f5a0ff7a7f1bcae02b Mon Sep 17 00:00:00 2001 From: Shmuel Zeigerman Date: Sat, 21 Feb 2015 17:32:42 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/luamacro/_globalinfo.lua | 4 ++-- plugins/luamacro/changelog | 6 +++++- plugins/luamacro/luafar/luamacro.c | 7 ++++++- plugins/luamacro/luamacro.lua | 8 ++------ plugins/luamacro/luamacro.rc | 2 +- plugins/luamacro/utils.lua | 6 +++--- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/plugins/luamacro/_globalinfo.lua b/plugins/luamacro/_globalinfo.lua index 1323b9dd16..45c22839a9 100644 --- a/plugins/luamacro/_globalinfo.lua +++ b/plugins/luamacro/_globalinfo.lua @@ -1,7 +1,7 @@ function export.GetGlobalInfo() return { - Version = { 1, 0, 0, 485 }, - MinFarVersion = { 3, 0, 0, 4274 }, + Version = { 1, 0, 0, 486 }, + MinFarVersion = { 3, 0, 0, 4275 }, Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"), Title = "LuaMacro", Description = "Far macros in Lua", diff --git a/plugins/luamacro/changelog b/plugins/luamacro/changelog index e1443e9a7a..6e265e8be2 100644 --- a/plugins/luamacro/changelog +++ b/plugins/luamacro/changelog @@ -1,4 +1,8 @@ -shmuel 21.02.2015 00:56:10 +0200 - build 485 +shmuel 21.02.2015 19:30:30 +0200 - build 486 + +1. Рефакторинг. + +shmuel 21.02.2015 00:56:10 +0200 - build 485 1. Рефакторинг. diff --git a/plugins/luamacro/luafar/luamacro.c b/plugins/luamacro/luafar/luamacro.c index dbe3871c40..286abbe504 100644 --- a/plugins/luamacro/luafar/luamacro.c +++ b/plugins/luamacro/luafar/luamacro.c @@ -68,7 +68,12 @@ HANDLE Open_Luamacro(lua_State* L, const struct OpenInfo *Info) } ReturnType = lua_type(L,-2)==LUA_TNUMBER ? lua_tointeger(L,-2) : 1; - if(lua_type(L,-1) != LUA_TTABLE) + if (lua_istable(L,-2)) + { + lua_pop(L,1); + lua_pushvalue(L,-1); + } + if (!lua_istable(L,-1)) { InitMPR(L, &om_info->Ret, 0, ReturnType); lua_pop(L,2); diff --git a/plugins/luamacro/luamacro.lua b/plugins/luamacro/luamacro.lua index 245458a56c..d7db3f0e48 100644 --- a/plugins/luamacro/luamacro.lua +++ b/plugins/luamacro/luamacro.lua @@ -29,10 +29,6 @@ local function pack (...) return { n=select("#",...), ... } end -local function pack3 (v1, v2, v3, ...) - return v1, v2, v3, { n=select("#",...), ... } -end - -- Override coroutine.resume for scripts, making it possible to call Keys(), -- print(), Plugin.Call(), exit(), etc. from nested coroutines. function coroutine.resume(co, ...) @@ -384,12 +380,12 @@ function export.Open (OpenFrom, arg1, ...) elseif calltype==F.MCT_PANELSORT then if panelsort then TablePanelSort = { panelsort.SortPanelItems(...) } - if TablePanelSort[1] then return F.MPRT_NORMALFINISH, TablePanelSort end + if TablePanelSort[1] then return TablePanelSort end end elseif calltype==F.MCT_GETCUSTOMSORTMODES then if panelsort then TablePanelSort = panelsort.GetSortModes() - return F.MPRT_NORMALFINISH, TablePanelSort + return TablePanelSort end end diff --git a/plugins/luamacro/luamacro.rc b/plugins/luamacro/luamacro.rc index 53bd6c5ded..004e61a644 100644 --- a/plugins/luamacro/luamacro.rc +++ b/plugins/luamacro/luamacro.rc @@ -1,6 +1,6 @@ #include -#define PLUGIN_BUILD 485 +#define PLUGIN_BUILD 486 #define PLUGIN_DESC "Lua Macros for Far Manager" #define PLUGIN_NAME "LuaMacro" #define PLUGIN_FILENAME "luamacro.dll" diff --git a/plugins/luamacro/utils.lua b/plugins/luamacro/utils.lua index 72215e69d1..93d7323705 100644 --- a/plugins/luamacro/utils.lua +++ b/plugins/luamacro/utils.lua @@ -470,9 +470,9 @@ local function EnumMacros (strArea, resetEnum) EnumState.index = EnumState.index + 1 local macro = LoadedMacros[EnumState.index] if macro then - if macro.area and macro.area:lower():find(area) then + if not macro.disabled and macro.area and macro.area:lower():find(area) then LastMessage = pack(macro.key, macro.description or "") - return F.MPRT_NORMALFINISH, LastMessage + return LastMessage end else EnumState.index = 0 @@ -906,7 +906,7 @@ local function GetMacroWrapper (argMode, argKey, argUseCommon) local macro,area = GetMacro(argMode, argKey, argUseCommon, true) if macro then LastMessage = pack(GetAreaCode(area), macro.code or "", macro.description or "", macro.flags) - return F.MPRT_NORMALFINISH, LastMessage + return LastMessage end end