diff --git a/enc/enc_lua/luafar_manual.tsi b/enc/enc_lua/luafar_manual.tsi index 1ae794b5e3..1551ee54bd 100644 --- a/enc/enc_lua/luafar_manual.tsi +++ b/enc/enc_lua/luafar_manual.tsi @@ -3954,7 +3954,7 @@ id=31 lv=2 dt=Text nm=editor.GetString -mtime=3682770766 +mtime=3921827714
#_**Note:** #_ This function is an extension over its prototype in Far API. @@ -3980,10 +3980,11 @@ mtime=3682770766 #_ #_**Description:** #_ The function's behavior depends on its *Mode* argument: -#_ Mode: 0 = returns: table LineInfo; changes current position: no -#_ 1 = returns: table LineInfo; changes current position: yes -#_ 2 = returns: StringText,StringEOL; changes current position: yes -#_ 3 = returns: StringText,StringEOL; changes current position: no +#_ Mode: 0 = returns: table LineInfo; changes current position: no +#_ 1 = returns: table LineInfo; changes current position: yes +#_ 2 = returns: StringText,StringEOL; changes current position: yes +#_ 3 = returns: StringText,StringEOL; changes current position: no +#_ 4 = returns: SelStart,SelEnd,StringLength; changes cur. position: no #_ #_ Modes 1 and 2 have a side effect: the current line position in the Editor #_ is set to *StringNumber*. diff --git a/plugins/luamacro/_globalinfo.lua b/plugins/luamacro/_globalinfo.lua index 60152163c8..97afe6076b 100644 --- a/plugins/luamacro/_globalinfo.lua +++ b/plugins/luamacro/_globalinfo.lua @@ -1,6 +1,6 @@ function export.GetGlobalInfo() return { - Version = { 3, 0, 0, 820 }, + Version = { 3, 0, 0, 821 }, MinFarVersion = { 3, 0, 0, 6214 }, Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"), Title = "LuaMacro", diff --git a/plugins/luamacro/changelog b/plugins/luamacro/changelog index 1cc970133c..a32f1f4731 100644 --- a/plugins/luamacro/changelog +++ b/plugins/luamacro/changelog @@ -1,3 +1,7 @@ +shmuel 2024-04-09 12:25:58+03:00 - build 821 + +1. LuaFAR: add new mode (4) to editor.GetString (only numeric values are returned). + shmuel 2024-04-08 00:04:02+03:00 - build 820 1. LuaFAR: refactoring. diff --git a/plugins/luamacro/luafar/service.c b/plugins/luamacro/luafar/service.c index d976c4f7d7..a4cc574412 100644 --- a/plugins/luamacro/luafar/service.c +++ b/plugins/luamacro/luafar/service.c @@ -782,7 +782,7 @@ static int _EditorGetString(lua_State *L, int is_wide) struct EditorGetString egs = {0,0,0,NULL,NULL,0,0}; egs.StructSize = sizeof(egs); - if (mode == 0 || mode == 3) + if (mode == 0 || mode == 3 || mode == 4) { egs.StringNumber = line_num; res = Info->EditorControl(EditorId, ECTL_GETSTRING, 0, &egs) != 0; @@ -807,6 +807,13 @@ static int _EditorGetString(lua_State *L, int is_wide) return 2; } + else if (mode == 4) + { + lua_pushinteger(L, egs.SelStart+1); + lua_pushinteger(L, egs.SelEnd); + lua_pushinteger(L, egs.StringLength); + return 3; + } else { lua_createtable(L, 0, 6); diff --git a/plugins/luamacro/luafar/version.h b/plugins/luamacro/luafar/version.h index c932b9911d..35d722ca84 100644 --- a/plugins/luamacro/luafar/version.h +++ b/plugins/luamacro/luafar/version.h @@ -1,3 +1,3 @@ #include -#define PLUGIN_BUILD 820 +#define PLUGIN_BUILD 821