Skip to content

Commit

Permalink
MacroAPI: extend mf.udlsplit
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Jan 5, 2025
1 parent bc82fe8 commit 1ff4ca3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions far/src/macro/macroapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class FarMacroApi
int waitkeyFunc();
int windowscrollFunc();
int xlatFunc();
int UDList_Split();
int udlSplitFunc();

private:
int SendValue(FarMacroValue &Value);
Expand Down Expand Up @@ -1201,7 +1201,7 @@ int64_t KeyMacro::CallFar(int CheckCode, const FarMacroCall* Data)
}

case MCODE_UDLIST_SPLIT:
return api.UDList_Split();
return api.udlSplitFunc();

case MCODE_FAR_GETINFO:
return api.fargetinfoFunc();
Expand Down Expand Up @@ -3100,21 +3100,24 @@ int FarMacroApi::kbdLayoutFunc()
}

//### temporary function, for test only
int FarMacroApi::UDList_Split()
int FarMacroApi::udlSplitFunc()
{
auto Params = parseParams(2);
auto Flags = (unsigned)Params[0].getInteger();
auto Subj = Params[1].toString();

UserDefinedList udl(Flags);
if (udl.Set(Subj) && udl.Size())
{
const wchar_t* str;
for (int i=0; (str=udl.Get(i)); i++)
PassString(str);
auto Params = parseParams(3);
auto Subj = Params[0].toString();
auto Separ = Params[1].toString();
auto Flags = (unsigned)Params[2].getInteger();

UserDefinedList udl(Flags, Separ);
if (udl.Set(Subj) && udl.Size()) {
auto Values = new FarMacroValue[udl.Size()];
for (size_t i=0; i < udl.Size(); i++) {
Values[i].Type = FMVT_STRING;
Values[i].String = udl.Get(i);
}
PassArray(Values, udl.Size());
delete[] Values;
}
else
{
else {
PassBoolean(false);
}
return 0;
Expand Down
Binary file modified luafar/manuals/macroapi_manual_linux.chm
Binary file not shown.

0 comments on commit 1ff4ca3

Please sign in to comment.