lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Aug 5, 2008 at 4:59 AM, KHMan <keinhong@gmail.com> wrote:
> In any case, there are probably better solutions available to the
> OP, e.g. that does not flash console windows, if he chooses an
> extended version of SciTE, e.g. like Steve Donovan's version.

My strategy has been to totally avoid doing a new version ;) There are
enough SciTE versions as it is, and it's a pain to look after a new
one.  That is the main reason that I petitioned for the exposing of
the Lua libraries from SciTE.

However, cool things can be done just with extensions:

http://mysite.mweb.co.za/residents/sdonovan/SciTE/scite.png
http://mysite.mweb.co.za/residents/sdonovan/SciTE/gui_ext.zip

This shows how an extension DLL can actually modify the SciTE frame
itself, without any core changes, using subclassing trickery.

Anyway, to keep OT; gui.dll provides gui.run, and this little script
will open an URL on the double-clicked line:

function OnDoubleClick()
    local lno = editor:LineFromPosition(editor.CurrentPos)
    local line = editor:GetLine(lno-1)
    local url = line:match('(http://[%w_/%.]+)')
    if not url then
        url = line:match('(file://[%w_/%.:]+)')
    end
    if url then
        gui.run(url)
    end
end

(The fiddling with lines comes from the fact that after a double-click
the current line is one plus the double-clicked line)

Perhaps as KHman suggests we move this to the SciTE list, since
discussions about other people's editors can be boring.

steve d.