Created an extra command, to implement appropriat cmd+w behaviour on mac.
This commit is contained in:
parent
cc568e65fc
commit
fd3f25608f
|
@ -11,6 +11,15 @@ local t = {
|
||||||
node:close_active_view(core.root_view.root_node)
|
node:close_active_view(core.root_view.root_node)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
["root:close-or-quit"] = function()
|
||||||
|
local node = core.root_view:get_active_node()
|
||||||
|
if node and (not node:is_empty() or not node.is_primary_node) then
|
||||||
|
node:close_active_view(core.root_view.root_node)
|
||||||
|
else
|
||||||
|
core.quit()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
["root:close-all"] = function()
|
["root:close-all"] = function()
|
||||||
core.confirm_close_all(core.root_view.close_all_docviews, core.root_view)
|
core.confirm_close_all(core.root_view.close_all_docviews, core.root_view)
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -17,7 +17,8 @@ local function keymap_macos(keymap)
|
||||||
["cmd+ctrl+i"] = "root:switch-to-up",
|
["cmd+ctrl+i"] = "root:switch-to-up",
|
||||||
["cmd+ctrl+k"] = "root:switch-to-down",
|
["cmd+ctrl+k"] = "root:switch-to-down",
|
||||||
|
|
||||||
["cmd+w"] = "root:close",
|
|
||||||
|
["cmd+w"] = "root:close-or-quit",
|
||||||
["ctrl+tab"] = "root:switch-to-next-tab",
|
["ctrl+tab"] = "root:switch-to-next-tab",
|
||||||
["ctrl+shift+tab"] = "root:switch-to-previous-tab",
|
["ctrl+shift+tab"] = "root:switch-to-previous-tab",
|
||||||
["cmd+pageup"] = "root:move-tab-left",
|
["cmd+pageup"] = "root:move-tab-left",
|
||||||
|
@ -31,7 +32,6 @@ local function keymap_macos(keymap)
|
||||||
["cmd+7"] = "root:switch-to-tab-7",
|
["cmd+7"] = "root:switch-to-tab-7",
|
||||||
["cmd+8"] = "root:switch-to-tab-8",
|
["cmd+8"] = "root:switch-to-tab-8",
|
||||||
["cmd+9"] = "root:switch-to-tab-9",
|
["cmd+9"] = "root:switch-to-tab-9",
|
||||||
|
|
||||||
["cmd+f"] = "find-replace:find",
|
["cmd+f"] = "find-replace:find",
|
||||||
["cmd+r"] = "find-replace:replace",
|
["cmd+r"] = "find-replace:replace",
|
||||||
["f3"] = "find-replace:repeat-find",
|
["f3"] = "find-replace:repeat-find",
|
||||||
|
|
|
@ -584,7 +584,7 @@ end
|
||||||
|
|
||||||
function Node:is_empty()
|
function Node:is_empty()
|
||||||
if self.type == "leaf" then
|
if self.type == "leaf" then
|
||||||
return #self.views == 0
|
return #self.views == 0 or (#self.views == 1 and self.views[1]:is(EmptyView))
|
||||||
else
|
else
|
||||||
return self.a:is_empty() and self.b:is_empty()
|
return self.a:is_empty() and self.b:is_empty()
|
||||||
end
|
end
|
||||||
|
@ -833,7 +833,7 @@ function RootView:on_mouse_moved(x, y, dx, dy)
|
||||||
core.request_cursor(node.active_view.cursor)
|
core.request_cursor(node.active_view.cursor)
|
||||||
end
|
end
|
||||||
if node and self.dragged_node and (self.dragged_node[1] ~= node or (tab_index and self.dragged_node[2] ~= tab_index))
|
if node and self.dragged_node and (self.dragged_node[1] ~= node or (tab_index and self.dragged_node[2] ~= tab_index))
|
||||||
and node.type == "leaf" and #node.views > 0 and node.views[1]:is(DocView) then
|
and node.type == "leaf" and #node.views > 0 and node.views[1]:is(DocView) then
|
||||||
local tab = self.dragged_node[1].views[self.dragged_node[2]]
|
local tab = self.dragged_node[1].views[self.dragged_node[2]]
|
||||||
if self.dragged_node[1] ~= node then
|
if self.dragged_node[1] ~= node then
|
||||||
for i, v in ipairs(node.views) do if v.doc == tab.doc then tab = nil break end end
|
for i, v in ipairs(node.views) do if v.doc == tab.doc then tab = nil break end end
|
||||||
|
|
Loading…
Reference in New Issue