diff --git a/plugins/luafarsearch/build/define.lua b/plugins/luafarsearch/build/define.lua index 41663dd..c9b9dc0 100644 --- a/plugins/luafarsearch/build/define.lua +++ b/plugins/luafarsearch/build/define.lua @@ -3,7 +3,7 @@ -- Definitions VER_MAJOR = "3" VER_MINOR = "46" -VER_MICRO = "3" +VER_MICRO = "4" MINFARVERSION = "{ 3, 0, 0, 4878 }" diff --git a/plugins/luafarsearch/doc/changelog.txt b/plugins/luafarsearch/doc/changelog.txt index 3721a68..204055d 100644 --- a/plugins/luafarsearch/doc/changelog.txt +++ b/plugins/luafarsearch/doc/changelog.txt @@ -2,6 +2,9 @@ Legend: [+] added; [-] deleted; [*] changed; [!] fixed; ------------------------------------------------------------------ +2024-10-10, v3.46.4 + [+] Dialog "Persistent settings". + 2024-04-13, v3.46.3 [!] Fixes. diff --git a/plugins/luafarsearch/doc/license.txt b/plugins/luafarsearch/doc/license.txt index 2582ce9..f5191fb 100644 --- a/plugins/luafarsearch/doc/license.txt +++ b/plugins/luafarsearch/doc/license.txt @@ -1,7 +1,7 @@ License of LuaFAR Search v3.x ----------------------------------- -Copyright (C) Shmuel Zeigerman 2009-2023 +Copyright (C) Shmuel Zeigerman 2009-2024 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/plugins/luafarsearch/lfs_eng.hlf.mcr b/plugins/luafarsearch/lfs_eng.hlf.mcr index 0309495..c454987 100644 --- a/plugins/luafarsearch/lfs_eng.hlf.mcr +++ b/plugins/luafarsearch/lfs_eng.hlf.mcr @@ -1587,3 +1587,12 @@ and will not be processed. The syntax of masks is identical to Far-style ~file masks~@:FileMasks@. ~Contents~@Contents@ + +@PersistentSettings +$ #Persistent settings# +^#Persistent settings# + + The settings that are checked on this dialog persist between Far Manager sessions. + The settings that are not checked will be set to their respective defaults in a next session. + + ~Contents~@Contents@ diff --git a/plugins/luafarsearch/lfs_lang.templ b/plugins/luafarsearch/lfs_lang.templ index 7a8bd0d..e86753b 100644 --- a/plugins/luafarsearch/lfs_lang.templ +++ b/plugins/luafarsearch/lfs_lang.templ @@ -1015,4 +1015,9 @@ MErrorCreateOutputFile "Ошибка создания целевого файла" upd: +MDlgPersistentSettings +"Persistent settings" +"Постоянные настройки" +"Configuraciones persistentes" + // End file // diff --git a/plugins/luafarsearch/lfs_rus.hlf.mcr b/plugins/luafarsearch/lfs_rus.hlf.mcr index 4324418..a7b621e 100644 --- a/plugins/luafarsearch/lfs_rus.hlf.mcr +++ b/plugins/luafarsearch/lfs_rus.hlf.mcr @@ -1605,3 +1605,12 @@ $ #Фильтр папок# Синтаксис масок идентичен ~Маскам файлов~@:FileMasks@ в стиле Фара. ~Содержание~@Contents@ + +@PersistentSettings +$ #Постоянные настройки# +^#Постоянные настройки# + + Настройки, отмеченные в данном диалоге, сохраняются между сессиями Far Manager. + Неотмеченные настройки будут установлены в значения по умолчанию в следующей сессии. + + ~Contents~@Contents@ diff --git a/plugins/luafarsearch/lfsearch.lua b/plugins/luafarsearch/lfsearch.lua index 13d897d..2dbf344 100644 --- a/plugins/luafarsearch/lfsearch.lua +++ b/plugins/luafarsearch/lfsearch.lua @@ -5,6 +5,7 @@ -- The reason: FSF.GetReparsePointInfo() did not work in the range of builds [4425-4876]. local F = far.Flags +local M -- forward declaration local MenuFlags = bit64.bor(F.FMENU_WRAPMODE, F.FMENU_AUTOHIGHLIGHT) local PluginConfigGuid1 = win.Uuid("B2C08615-ED7C-491D-BE5C-8758FDAB9139") local PluginMenuGuid1 = win.Uuid("3D5E7985-3B5D-4777-A572-BA7C621B3731") @@ -19,18 +20,63 @@ end -- Set the defaults: prioritize safety and "least surprise". local function NormDataOnFirstRun() local data = _Plugin.History:field("main") - data.bAdvanced = false - data.bConfirmReplace = true - data.bDelEmptyLine = false - data.bDelNonMatchLine = false - data.bGrepInverseSearch = false - data.bInverseSearch = false - data.bMultiPatterns = false - data.bRepIsFunc = false - data.bSearchBack = false - data.bUseDirFilter = false - data.bUseFileFilter = false - data.sSearchArea = "FromCurrFolder" + local pers = _Plugin.History:field("persistent") + local setval = function(name, dflt) + if data[name]==nil or not pers[name] then data[name]=dflt; end + end + setval("bAdvanced" , false) + setval("bConfirmReplace" , true) + setval("bDelEmptyLine" , false) + setval("bDelNonMatchLine" , false) + setval("bGrepInverseSearch" , false) + setval("bInverseSearch" , false) + setval("bMultiPatterns" , false) + setval("bRepIsFunc" , false) + setval("bSearchBack" , false) + setval("bUseDirFilter" , false) + setval("bUseFileFilter" , false) + setval("sSearchArea" , "FromCurrFolder") +end + + +local function PersistentDialog() + local sd = require "far2.simpledialog" + local items = { + width = 0; + guid="325E21EA-0E78-4FF8-A800-8710896CE606"; + help="PersistentSettings"; + {tp="dbox"; text=M.MDlgPersistentSettings; }, + {tp="chbox"; name="bAdvanced" ; text=M.MDlgAdvanced ; }, + {tp="chbox"; name="bConfirmReplace" ; text=M.MDlgConfirmReplace ; }, + {tp="chbox"; name="bDelEmptyLine" ; text=M.MDlgDelEmptyLine ; }, + {tp="chbox"; name="bDelNonMatchLine" ; text=M.MDlgDelNonMatchLine ; }, + {tp="chbox"; name="bGrepInverseSearch"; text=M.MDlgGrepInverseSearch ; }, + {tp="chbox"; name="bInverseSearch" ; text=M.MDlgInverseSearch ; }, + {tp="chbox"; name="bMultiPatterns" ; text=M.MDlgMultiPatterns ; }, + {tp="chbox"; name="bRepIsFunc" ; text=M.MDlgRepIsFunc ; }, + {tp="chbox"; name="bSearchBack" ; text=M.MDlgReverseSearch ; }, + {tp="chbox"; name="bUseDirFilter" ; text=M.MDlgUseDirFilter ; }, + {tp="chbox"; name="bUseFileFilter" ; text=M.MDlgUseFileFilter ; }, + {tp="chbox"; name="sSearchArea" ; text=M.MDlgSearchArea ; }, + {tp="sep"; }, + {tp="butt"; default=1; centergroup=1; text=M.MOk; }, + {tp="butt"; cancel=1; centergroup=1; text=M.MCancel; }, + } + for _,v in ipairs(items) do + if v.text and v.name then + v.text=v.text:gsub("&",""):gsub(":$","") + v.text = ("%-30s(%s)"):format(v.text, v.name) + end + end + + local pers = _Plugin.History:field("persistent") + local dlg = sd.New(items) + dlg:LoadData(pers) + local out = dlg:Run() + if out then + dlg:SaveData(out, pers) + _Plugin.History:save() + end end @@ -68,7 +114,7 @@ local libUtils = require "far2.utils" local Common = require "lfs_common" local EditMain = require "lfs_editmain" local Editors = require "lfs_editors" -local M = require "lfs_message" +M = require "lfs_message" local MReplace = require "lfs_mreplace" local Panels = require "lfs_panels" -- call only after modifying package.cpath local Rename = require "lfs_rename" @@ -276,16 +322,17 @@ function export.Configure (Guid) -- luacheck: no unused args HelpTopic = "Contents", } local items = { - { text=M.MConfigTitleEditor; action=Common.EditorConfigDialog; }, - { text=M.MConfigTitleTmpPanel; action=Panels.ConfigDialog; }, - { text=M.MConfigTitleCommon; action=Common.ConfigDialog; }, + { text=M.MConfigTitleEditor; action=Common.EditorConfigDialog; }, + { text=M.MConfigTitleTmpPanel; action=Panels.ConfigDialog; }, + { text=M.MConfigTitleCommon; action=Common.ConfigDialog; }, + { text=M.MDlgPersistentSettings; action=PersistentDialog; }, } local userItems = libUtils.LoadUserMenu("_usermenu.lua") libUtils.AddMenuItems(items, userItems.config, M) while true do local item, pos = far.Menu(properties, items) if not item then break end - if pos <= 3 then + if pos <= #items then item.action() else libUtils.RunUserItem(item, item.arg)