From 843367ffb298b87254676fc3603a3f63aa124bc6 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 21 Sep 2008 13:14:33 -0400 Subject: Added uri_dropped handler in core/events.lua to open dragged and dropped files. --- core/events.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core') diff --git a/core/events.lua b/core/events.lua index 031d35fb..c707b872 100644 --- a/core/events.lua +++ b/core/events.lua @@ -396,6 +396,20 @@ add_handler('double_click', end end) +add_handler('uri_dropped', + function(uris) + for uri in uris:gmatch('[^\r\n\f]+') do + if uri:match('^file://') then + uri = uri:match('^file://([^\r\n\f]+)') + if WIN32 then + uri = uri:sub(2, -1) -- ignore leading '/' + uri = uri:gsub('%%20', ' ') -- sub back for spaces + end + textadept.io.open(uri) + end + end + end) + --- -- [Local table] A table of (integer) brace characters with their matches. -- @class table -- cgit v1.2.3