Code: Select all
Macro {
area = "Editor";
key = "CtrlF4";
flags = "";
description = "Editor: Reload a file";
action = function()
Keys("F6 F6")
end;
}
Code: Select all
Macro {
area = "Editor";
key = "CtrlF4";
flags = "";
description = "Editor: Reload a file";
action = function()
Keys("F6 F6")
end;
}
RTFM:
А вообще почин похвальный. Если ещё и (только) на время переключения будете отключать историю, чтобы туда не попадал просмотр, будет вообще здорово.[i][b]%FarHome%\Encyclopedia\macroapi_manual.ru.chm[/b][/i] wrote:Editor.State
: … 0x00000008 редактируемый файл модифицирован (в статусной строке редактора присутствует символ '*')
Code: Select all
--[[
Editor: Reload a file
http://forum.farmanager.com/viewtopic.php?f=57&t=10599
This macro allows to reload a file from the disk.
Any changes made in the editor may be lost.
]]
---------------------------------------------------------------------------
local EDITOR_MODIFIED = 0x00000008
local MSG_WARNING = 0x00000001
local MSG_OKCANCEL = 0x00020000
---------------------------------------------------------------------------
local msg_title = "Warning"
local msg_text = "FIle modified, everything will be lost"
---------------------------------------------------------------------------
Macro {
area = "Editor";
key = "CtrlR";
flags = "";
description = "Editor: Reload a file";
action = function()
local state = bit.band(Editor.State, EDITOR_MODIFIED)
if state ~= 0 then
local answer = msgbox(msg_title, msg_text, MSG_WARNING + MSG_OKCANCEL)
if answer ~= 1 then return end
end
local history = Far.DisableHistory()
Far.DisableHistory(-1)
-- Avoid saving the file
Keys("F6 " .. ( state ~= 0 and "Right Enter" or "" ) .. " F6")
Far.DisableHistory(history)
end;
}
---------------------------------------------------------------------------
-- EOF
Я за этот вариант — по аналогии с файловой панелью.
Такие мысли бродили в моей голове. Но я - пас. Я не настолько знаток luafar, чтобы запрограммировать это. В notepad++ такая фича полностью реализована. В notepad-mod2 файл надо перечитывать вручную.
Самому тоже нравится единообразие. Исправил в сообщении выше. Оигинал тут - https://github.com/ildar-shaimordanov/t ... adFile.lua
Так маросом же по Shift-F4 и перегружать...siberia-man wrote:2useven10, SHIFT+F4 - для создания нового файла. Не хотелось бы ломать устоявшиеся привычки.
Лично я предпочёл бы иметь выбор: