aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-02-12 22:42:10 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2009-02-12 22:42:10 -0500
commit84a40c95280504d6ad2d95f84b205ec22f6b99c5 (patch)
tree70da7e19ae9439485ac418c6078de615564a9a90 /core
parent8140eb174a9c5a16f818245a38d25b55cbc52a2e (diff)
downloadtextadept-84a40c95280504d6ad2d95f84b205ec22f6b99c5.tar.gz
textadept-84a40c95280504d6ad2d95f84b205ec22f6b99c5.zip
Load dropped directories into the PM file browser; core/ext/pm/file_browser.lua
Diffstat (limited to 'core')
-rw-r--r--core/ext/pm/file_browser.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua
index 45c1db4c..17723c70 100644
--- a/core/ext/pm/file_browser.lua
+++ b/core/ext/pm/file_browser.lua
@@ -79,3 +79,21 @@ function perform_menu_action(menu_id, selected_item)
})
end
end
+
+-- load the dropped directory (if any) into the file browser; events.lua's
+-- "uri_dropped" handler already opens dropped files
+textadept.events.add_handler('uri_dropped',
+ function(uris)
+ for uri in uris:gmatch('[^\r\n\f]+') do
+ if uri:find('^file://') then
+ uri = uri:match('^file://([^\r\n\f]+)')
+ uri = uri:gsub('%%20', ' ') -- sub back for spaces
+ if WIN32 then uri = uri:sub(2, -1) end -- ignore leading '/'
+ if lfs.attributes(uri).mode == 'directory' then
+ textadept.pm.entry_text = uri
+ textadept.pm.activate()
+ return
+ end
+ end
+ end
+ end)