aboutsummaryrefslogtreecommitdiff
path: root/core/events.lua
diff options
context:
space:
mode:
Diffstat (limited to 'core/events.lua')
-rw-r--r--core/events.lua14
1 files changed, 14 insertions, 0 deletions
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