Repository :
https://github.com/FarGroup/FarManager
On branch : master
Link :
https://github.com/FarGroup/FarManager/commit/27b03da8a552131852be27ca4a8ce37cf2b79edd
>---------------------------------------------------------------
commit 27b03da8a552131852be27ca4a8ce37cf2b79edd
Author: Shmuel Zeigerman <
solo...@gmail.com>
Date: Sat Jan 10 10:45:00 2026 +0200
LuaFAR: far.Message 1-st param: replace nulls with spaces
>---------------------------------------------------------------
27b03da8a552131852be27ca4a8ce37cf2b79edd
plugins/luamacro/_globalinfo.lua | 2 +-
plugins/luamacro/changelog | 4 ++++
plugins/luamacro/luafar/lf_service.c | 29 +++++++++++++++++------------
plugins/luamacro/luafar/lf_version.h | 2 +-
4 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/plugins/luamacro/_globalinfo.lua b/plugins/luamacro/_globalinfo.lua
index e82ed6768..768bdce76 100644
--- a/plugins/luamacro/_globalinfo.lua
+++ b/plugins/luamacro/_globalinfo.lua
@@ -1,6 +1,6 @@
function export.GetGlobalInfo()
return {
- Version = { 3, 0, 0, 911 },
+ Version = { 3, 0, 0, 912 },
MinFarVersion = { 3, 0, 0, 6564 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
diff --git a/plugins/luamacro/changelog b/plugins/luamacro/changelog
index 526825891..ff33447dd 100644
--- a/plugins/luamacro/changelog
+++ b/plugins/luamacro/changelog
@@ -1,3 +1,7 @@
+shmuel 2026-01-10 10:42:46+02:00 - build 912
+
+1. far.Message, 1-st param: replace nulls with spaces
+
shmuel 2025-12-31 00:30:52+02:00 - build 911
1. far.Show: CtrlC and CtrlIns copy the selected line to clipboard and close the menu.
diff --git a/plugins/luamacro/luafar/lf_service.c b/plugins/luamacro/luafar/lf_service.c
index ad83a902c..080bc6e1e 100644
--- a/plugins/luamacro/luafar/lf_service.c
+++ b/plugins/luamacro/luafar/lf_service.c
@@ -2170,25 +2170,30 @@ void LF_Error(lua_State *L, const wchar_t* aMsg)
// Return: -1 if escape pressed, else - button number chosen (1 based).
static int far_Message(lua_State *L)
{
- int ret;
- const wchar_t *Msg, *Title, *Buttons, *HelpTopic;
- const char *Flags;
- const GUID *Id;
+ const wchar_t *Msg;
luaL_checkany(L,1);
lua_settop(L,6);
- Msg = NULL;
- global_tolstring(L, 1, NULL);
+ size_t MsgLen;
+ const char *str = global_tolstring(L, 1, &MsgLen);
+ char *copy = malloc(MsgLen);
+ for (size_t i=0; i < MsgLen; i++) {
+ copy[i] = str[i] ? str[i] : ' '; // replace '\0' with a space
+ }
+ lua_pop(L, 1);
+ lua_pushlstring(L, copy, MsgLen);
+ free(copy);
+
Msg = check_utf8_string(L, -1, NULL);
lua_replace(L,1);
- Title = opt_utf8_string(L, 2, L"Message");
- Buttons = opt_utf8_string(L, 3, L";OK");
- Flags = luaL_optstring(L, 4, "");
- HelpTopic = opt_utf8_string(L, 5, NULL);
- Id = (lua_type(L,6)==LUA_TSTRING && lua_objlen(L,6)==sizeof(GUID)) ?
+ const wchar_t *Title = opt_utf8_string(L, 2, L"Message");
+ const wchar_t *Buttons = opt_utf8_string(L, 3, L";OK");
+ const char *Flags = luaL_optstring(L, 4, "");
+ const wchar_t *HelpTopic = opt_utf8_string(L, 5, NULL);
+ const GUID *Id = (lua_type(L,6)==LUA_TSTRING && lua_objlen(L,6)==sizeof(GUID)) ?
(const GUID*)lua_tostring(L,6) : NULL;
- ret = LF_Message(L, Msg, Title, Buttons, Flags, HelpTopic, Id);
+ int ret = LF_Message(L, Msg, Title, Buttons, Flags, HelpTopic, Id);
lua_pushinteger(L, ret<0 ? ret : ret+1);
return 1;
}
diff --git a/plugins/luamacro/luafar/lf_version.h b/plugins/luamacro/luafar/lf_version.h
index a31e9fb19..45c5fd25d 100644
--- a/plugins/luamacro/luafar/lf_version.h
+++ b/plugins/luamacro/luafar/lf_version.h
@@ -1,3 +1,3 @@
#include <farversion.hpp>
-#define PLUGIN_BUILD 911
+#define PLUGIN_BUILD 912