Frank Wunderlich wrote:
i want to change my "open files from project"-lua-script to a userlist (not
open all, only write them to a list).
is there a possibility to hold "hidden" data, so i can only display filename
(hiding path)?
as i see in the other scripts, the userlist is only a string where the entries
separated by a char (editor.AutoCSeparator).
are there any simple examples? which IDs are not used?
It might not be "simple", but here are my current settings:
-- User Defined Lists (arbitrary numbers!)
local udl_Separator = "~"
local udl_SuperAbbr = 10
local udl_ListTools = 15
local udl_ListAHKFunctions = 20
-- [...]
function UserListShow(udl, list)
editorACS = editor.AutoCSeparator
editor.AutoCSeparator = string.byte(udl_Separator)
editor:UserListShow(udl, list)
editor.AutoCSeparator = editorACS
end
-- [...]
local abbrList =
{
-- [stuff...]
}
function SuperAbbr()
local titles = ''
for t, v in pairs(abbrList) do
titles = titles .. t .. udl_Separator
end
titles = string.sub(titles, 1, -2)
UserListShow(udl_SuperAbbr, titles)
end
local tools =
{
["Normalize line"] = { 1, Normalize },
["Sort selected lines"] = { 2, SortSelectedLines },
["Sort all lines"] = { 3, SortAllLines },
--~ ["T"] = { 5, F },
}
function LuaTools()
local tl = {}
for title, tool in pairs(tools) do
tl[tool[1]] = title
end
local toolList = table.concat(tl, udl_Separator)
UserListShow(udl_ListTools, toolList)
end
function CreateAHKFunctionList()
-- [...]
return rf .. rl .. rh
end
function ShowAHKFunctions()
UserListShow(udl_ListAHKFunctions, CreateAHKFunctionList())
end
-- [...]
function OnUserListSelection(lt, choice)
--~ print("OnUserListSelection: " .. lt .. ", " .. choice)
if lt == udl_ListTools then
local tool = tools[choice]
tool[2]()
return true
elseif lt == udl_SuperAbbr then
editor:InsertText(-1, abbrList[choice]["template"])
-- Should locate posChar, remove it and put the caret there
return true
elseif lt == udl_ListAHKFunctions then
CreateAHKFunctionList()
editor:GotoLine(ahkFunctions[choice] - 1)
return true
else
return false
end
end
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest