diff options
| author | 2008-09-21 13:14:33 -0400 | |
|---|---|---|
| committer | 2008-09-21 13:14:33 -0400 | |
| commit | 843367ffb298b87254676fc3603a3f63aa124bc6 (patch) | |
| tree | f91e300390f81867c98ea75d84248662239b42e8 | |
| parent | 14cc9fe52b4cc75553dd907882594467b16c5bf1 (diff) | |
| download | textadept-843367ffb298b87254676fc3603a3f63aa124bc6.tar.gz textadept-843367ffb298b87254676fc3603a3f63aa124bc6.zip | |
Added uri_dropped handler in core/events.lua to open dragged and dropped files.
| -rw-r--r-- | core/events.lua | 14 |
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 |
