Remove mouse command to remove directory and remap create directory

Create directory is now re-mapped to control+(left click).
This commit is contained in:
Francesco Abbate 2020-12-30 12:00:51 +01:00
parent f2faddbec7
commit b0686bbe87
1 changed files with 2 additions and 4 deletions

View File

@ -140,7 +140,7 @@ end
local function create_directory_in(item) local function create_directory_in(item)
local path = item.abs_filename local path = item.abs_filename
local basename = path:match("[^\\/]+$") local basename = path:match("[^\\/]+$")
core.command_view:enter("Create directory in " .. basename, function(text) core.command_view:enter("Create directory in " .. path, function(text)
local dirname = path .. PATHSEP .. text local dirname = path .. PATHSEP .. text
local success, err = system.mkdir(dirname) local success, err = system.mkdir(dirname)
if not success then if not success then
@ -156,9 +156,7 @@ function TreeView:on_mouse_pressed(button, x, y)
if not self.hovered_item then if not self.hovered_item then
return return
elseif self.hovered_item.type == "dir" then elseif self.hovered_item.type == "dir" then
if keymap.modkeys["shift"] and button == "middle" and self.hovered_item.depth == 0 then if keymap.modkeys["ctrl"] and button == "left" then
core.remove_project_directory(self.hovered_item.abs_filename)
elseif keymap.modkeys["alt"] and button == "left" then
create_directory_in(self.hovered_item) create_directory_in(self.hovered_item)
else else
self.hovered_item.expanded = not self.hovered_item.expanded self.hovered_item.expanded = not self.hovered_item.expanded