Hi there!
First I would like to thank you for Ion: it's simply spectacular!

I have some trouble in understanding how to use the method in object.
I've seen a script that should add support for history complection in WEdln:
http://www.modeemi.fi/~tuomov/repos/ion-scripts-3/scripts/histcompl.lua

This script is not working anymore, as far as I understand because of the new WComplProxy.

Basically, look at the script below:
defbindings("WEdln", {
               kpress("Control+r", "history_completor(_)"),
            }
         )
Mycompl = {
   [1] = "ciao",
   [2] = "ciaociao",
}
function history_completor(...)
   -- ioncore.write_savefile("debug", arg)
   arg[1]:set_completions(Mycompl)
end

If history_completor() is called with Control+r from the command line it will get the WEdln object. This way it is possible to use arg[1]:context() or arg[1].contents() to get some information to create the complections. But arg[1]:set_complections() will not set the complection table.

Instead if I call history_completor() with:
mod_query.query(_, TR("Prompt: "), nil, hanlder, history_completor, "lua")
in this case it will get, as argument, the WComplProxy object, the string in the command line and the cursor position.

So I have a question:is it possible to get the WComplProxy object from outside mod_query.query? In other words, can I set the complection table from outside the callback function to pass to mod_query.query? So far I was not able to find a way... and I'm getting the feeling it is not possible (I did not dig into the C code, so far). Any hint?

Thanks for your kind attention.
All the best.
Andrea

Reply via email to