aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-09-21 13:14:33 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2008-09-21 13:14:33 -0400
commit843367ffb298b87254676fc3603a3f63aa124bc6 (patch)
treef91e300390f81867c98ea75d84248662239b42e8 /core
parent14cc9fe52b4cc75553dd907882594467b16c5bf1 (diff)
downloadtextadept-843367ffb298b87254676fc3603a3f63aa124bc6.tar.gz
textadept-843367ffb298b87254676fc3603a3f63aa124bc6.zip
Added uri_dropped handler in core/events.lua to open dragged and dropped files.
Diffstat (limited to 'core')
-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